//www.tianjin-qmedu.com/matlabcentral/answers/questions?term=tag%3A%22function%22 MATLAB Answers - New Questions matching tag:"function" 2021-09-21T00:28:17Z 标签:www.tianjin-qmedu.com, 2005:问题/ 1457284 2021-09-21T00:28:17Z 2021-09-21T00:28:17Z 改变一个函数:值的表而不是表达式。 我有一个函数function oT = FrameToT(this, aFrame) %转换一个帧索引的时间点,以小时为单位。% %输入:% aFrame -帧索引或帧索引数组。% %输出:% t -时间点或时间点阵列,以小时为单位,自%实验开始。如果实验在成像之前开始,则设置starttt应指定%。= this.Get('start tt ') + (aFrame - 1) * (this.dT/60);我也有.csv文件,我读作为一个表,它给我这个(复制的只是部分输出)。ans = 1049×1 table Var1 ______ 24 26 28 30 32 34 36 38 40 42 44我希望我的oT就是这个时间表,对应的帧:第1帧- 24小时,第2帧- 26小时,等等。这个的误差是多少?谢谢你!时间= readtable(" /用户/ table.csv "); conversion = [aFrame, time]; oT = conversion[, t2]; 尖吻鲭鲨 //www.tianjin-qmedu.com/matlabcentral/profile/authors/11330292 标签:www.tianjin-qmedu.com, 2005:问题/ 1454949 2021 - 09 - 16 - t20:03:12z 2021 - 09 - 20 - t21:40:16z 功能中启用和关闭按钮 你好,我正在尝试创建一个GUI,它由一个二维平面和一个光标组成。用户将移动光标并探索平面。根据飞机的位置,用户可以点击“大头针”按钮,最多3大头针。为了进入下一个试验,一个“next”按钮将被启用基于两个条件:1)所有三个引脚都被放下2)飞机的1/3被探索。我试图实现这段代码,第70行,但是当两个条件都满足时,我没有看到“Next”按钮亮起来。有人能告诉我问题是什么,我应该如何解决它吗?代码:function dragpoints_2(xData,yData,xLower,xUpper,yLower, ypper) global x global y global count global point_count global points global area area = (1/3)*(20*20);assign ('base','points',points) count = 0; / /积分point_count = 0;点= 0 (1000 2); % First column is x and the second is y %Setting Up The Correct Directories setenv('PATH', [getenv('PATH') ':/usr/local/bin']); addpath('/usr/local/lib/openmha/mfiles/') javaaddpath('/usr/local/lib/openmha/mfiles/mhactl_java.jar') openmha = mha_start; %Starts openMHA software mha_query(openmha,'','read:final_dc_live.cfg'); %Selects the .cfg file to read if nargin == 0 xData = 0; yData = 0; xLower = -20; xUpper = 20; yLower = -20; yUpper = 20; end figure('unit','normalized',... 'position',[.1 .1 .8 .8]); handles.hbutton1 = uicontrol('style','pushbutton',..., 'unit','normalized',..., 'innerposition',[0.02 0.55 .08 .08],'fontname','Arial',... 'fontsize',36,'backgroundcolor','green','string','Pin','Tag','1'); handles.hbutton2 = uicontrol('style','pushbutton',..., 'unit','normalized',..., 'innerposition',[0.02 0.25 .08 .08],'fontname','Arial',... 'fontsize',36,'backgroundcolor','blue','string','Next','Tag','2','Enable','Off'); x = xData; y = yData; ax = axes('xlimmode','manual','ylimmode','manual'); ax.XLim = [xLower xUpper]; ax.YLim = [yLower yUpper]; %can change the marker size or marker type to make it more visible. %Currently is set to small points at a size of 2 so is not very visible. handles.hbutton1.Callback = {@button_callback}; line(x,y,'color','r','marker','.','markersize',105,'hittest','on','buttondownfcn',@clickmarker) %Callback For Start, Stop, Quit Buttons function button_callback(src, handles, ~) global x global y global count global area_explored global area buttonID = src.Tag; %Sets the tag for the buttons stateII= str2num(buttonID); %Converts the tag to a state %Drops the pin when clicks "Save" if (count == 3 || area_explored > area) set(handles.hbutton1,'Enable','Off') set(handles.hbutton2,'Enable','On') else if stateII == 1 % Dropping a pin xy = get(gca,'CurrentPoint'); x = xy(1,1); y = xy(1,2); %location = [x y] viscircles([x,y], 2); count = count + 1; end end function clickmarker(src,ev) set(ancestor(src,'figure'),'windowbuttonmotionfcn',{@dragmarker,src}) set(ancestor(src,'figure'),'windowbuttonupfcn',@stopdragging) function dragmarker(fig,ev,src) global x global y global points global point_count global area_explored %This calculates the area explored by the user x_range = range(points(:,1)); y_range = range(points(:,2)); area_explored = x_range * y_range %get current axes and coords %h2 = findall(groot,'Type','Axes'); buttonID = src.Tag; %Sets the tag for the buttons stateII= str2num(buttonID); %Converts the tag to a state if stateII == 1 h1 = gco; x = h1.XData; y = h1.YData; end try h1 = gca; x = h1.Children.XData; y = h1.Children.YData; catch try x = h1.Children(2).XData; y = h1.Children(2).YData; catch end end %coords=get(h1,'currentpoint'); xy = get(gca,'CurrentPoint'); x_curr = xy(1,1); y_curr = xy(1,2); %get all x and y data %check which data point has the smallest distance to the dragged point x_diff=abs(x-x_curr); y_diff=abs(y-y_curr); [~, index]=min(x_diff+y_diff); %create new x and y data and exchange coords for the dragged point x_new=x; y_new=y; x_new(index)=x_curr; y_new(index)=y_curr; point_count = point_count + 1; points(point_count,1) = x_curr; points(point_count,2) = y_curr; %update plot set(src,'xdata',x_new,'ydata',y_new); function stopdragging(fig, ev, ~) set(fig,'windowbuttonmotionfcn','') set(fig,'windowbuttonupfcn','') Thanks! Chemay绍拉 //www.tianjin-qmedu.com/matlabcentral/profile/authors/12108431 标签:www.tianjin-qmedu.com, 2005:问题/ 1456999 2021 - 09 - 20 - t14:05:04z 2021 - 09 - 20 - t18:59:45z 如何循环函数调用? 我想对函数Least_square()求值,经过多次迭代并返回它的和。我目前是这样做的fun = @(x) (Least_square(x,y1) + Least_square(x,y2) + Least_square(x,y3) + Least_square(x,y4))有没有更好的方法来做这个?因为我可能想评估它在多个迭代谢谢 Avish Naredi //www.tianjin-qmedu.com/matlabcentral/profile/authors/13840148 标签:www.tianjin-qmedu.com, 2005:问题/ 1456199 2021 - 09 - 19 - t04:43:08z 2021 - 09 - 19 - t23:31:20z 如何抑制正在创建的匿名功能句柄? 你好,我在一个循环中写了下面的匿名函数。是否有一种方法可以防止以下内容在每次迭代之后显示?行尾已经有一个分号了。谢谢你! 佩顿威尔逊 //www.tianjin-qmedu.com/matlabcentral/profile/authors/20825311 标签:www.tianjin-qmedu.com, 2005:问题/ 1456419 2021 - 09 - 19 - t19:47:33z 2021 - 09 - 19 - t19:47:33z 如何计算直方图的MSE ? 你好,我有一个威布尔分布的直方图。我手动拟合了这个直方图。你能帮我计算一下这张图的MSE吗?我写这段代码是为了适合柱状图pd=makedist('Weibull','a',0.06, 'b',0.625052);n = 236070;X = 0: .01:1.2;pdf_weibull = pdf (pd, X);nbins = 100;图(1);clf (); h = histogram(signalhist_poz, nbins); binedges = h.BinEdges; hold on plot(X,pdf_weibull,'LineWidth',2); % Normalize the density to match the total area of the histogram binwidth = abs(binedges(2)-binedges(1)); % Finds the width of each bin % this is where the magic happens area = n * binwidth; y = area * pdf_weibull; figure(2); clf(); histogram(signalhist_poz, 100); hold on; plot(X,y,'LineWidth',2) 学生助手 //www.tianjin-qmedu.com/matlabcentral/profile/authors/20970733 标签:www.tianjin-qmedu.com, 2005:问题/ 1456274 2021 - 09 - 19 - t08:29:31z 2021 - 09 - 19 - t12:58:41z 如何用网格计算二维中定义的向量函数? 嗨,伙计们。我想计算并得到二维中定义的向量函数的函数值。例如,我们假设函数定义在二维离散域中。这些在matlab中编码如下:fun = @(x, y) [sin(x) .* sin(x);cos (x)。* cos (y)];Xgrid = linspace(0, pi, 3);Ygrid = linspace(0, pi, 4);[xmesh, mesh] = meshgrid(xgrid, ygrid);我想要的结果是三维矩阵,比如result(:,: 1) = [0,1,0;0, 1, 0; 0, 1, 0 ; 0, 1, 0]; result(:,:,2) = [1, 0, -1 ; .5, 0, -.5 ; -.5, 0, .5 ; -1, 0, 1]; I tried fun(xmesh, ymesh) but it didn't give me the wanted result. Plese give me a novel advises. 全永贤 //www.tianjin-qmedu.com/matlabcentral/profile/authors/13718927 标签:www.tianjin-qmedu.com, 2005:问题/ 316509 2016 - 12 - 12 - t10:19:45z 2021 - 09 - 19 - t11:46:42z 分数延迟滤波器延迟一个简单的信号 大家好!所以,我想使用分数延迟滤波器延迟信号为0.075秒。我得到一个输入是1-10个信号的随机矩阵。信号:x = 0:0.2:π;s = sin (x);根据我的要求设计一个分数延迟滤波器,我使用:d = fdesign.fracdelay(0.075,'N',2);我的问题是把两者结合起来,所以我的正弦延迟了0.075s。那么,有人知道如何解决这个问题吗?亲切的问候Magnus354 Magnus354 //www.tianjin-qmedu.com/matlabcentral/profile/authors/9356773 标签:www.tianjin-qmedu.com, 2005:问题/ 1456189 2021 - 09 - 19 - t04:36:10z 2021-09-19T05:58:21Z 如何在for循环中添加元素到数组中 假设有一个数组sample=[2 4 5 6 3],我想创建一个函数,它能得到所有大于5的元素的和。对于这个例子,5+6= 11。我想做一个for循环来检查元素是否大于5,然后创建一个新的数组,所有的数字都大于5,然后使用sum(sample)。然而,我不确定如何创建一个新数组。For k= 1:numel(sample) if samples(k) >= 5%需要创建一个新数组,所有元素都大于5,从%sample数组end end 艾琳约翰斯 //www.tianjin-qmedu.com/matlabcentral/profile/authors/23612260 标签:www.tianjin-qmedu.com, 2005:问题/ 1453599 2021-09-15T09:31:18Z 2021 - 09 - 18 - t02:24:08z 错误时,使用Matlab生成的函数读取文件 你好,我试图ipmort一个数据文件到Matlab使用导入数据工具,然后使用生成函数,但我得到这个错误消息“不够的输入参数。If anyone can help me in fix this Error .... .i attach down the geneated function and the data file i am trying to import function jro19661111 = importfile(filename, startRow, endRow) % importfile从文本文件中导入数值数据作为一个矩阵。% JRO19661111 = IMPORTFILE(FILENAME) %为默认选择从文本文件FILENAME读取数据。% % JRO19661111 = IMPORTFILE(FILENAME, STARTROW, ENDROW) %通过文本文件FILENAME的ENDROW从STARTROW行读取数据。% %示例:% jro19661111 = importfile('jro19661111.001.txt', 1,8541);% %参见TEXTSCAN。% Auto-generated by MATLAB on 2011/09/15 13:23:41 %%初始化变量。if nargin<=2 startRow = 1;endRow =正; end %% Read columns of data as text: % For more information, see the TEXTSCAN documentation. formatSpec = '%6s%10s%10s%10s%10s%*10*s%*13*s%*11*s%*14*s%*14*s%*14s%11s%14s%[^\n\r]'; %% Open the text file. fileID = fopen(filename,'r'); %% Read columns of data according to the format. % This call is based on the structure of the file used to generate this code. If an error occurs for a different file, try regenerating the code from the Import Tool. dataArray = textscan(fileID, formatSpec, endRow(1)-startRow(1)+1, 'Delimiter', '', 'WhiteSpace', '', 'TextType', 'string', 'HeaderLines', startRow(1)-1, 'ReturnOnError', false, 'EndOfLine', '\r\n'); for block=2:length(startRow) frewind(fileID); dataArrayBlock = textscan(fileID, formatSpec, endRow(block)-startRow(block)+1, 'Delimiter', '', 'WhiteSpace', '', 'TextType', 'string', 'HeaderLines', startRow(block)-1, 'ReturnOnError', false, 'EndOfLine', '\r\n'); for col=1:length(dataArray) dataArray{col} = [dataArray{col};dataArrayBlock{col}]; end end %% Close the text file. fclose(fileID); %% Convert the contents of columns containing numeric text to numbers. % Replace non-numeric text with NaN. raw = repmat({''},length(dataArray{1}),length(dataArray)-1); for col=1:length(dataArray)-1 raw(1:length(dataArray{col}),col) = mat2cell(dataArray{col}, ones(length(dataArray{col}), 1)); end numericData = NaN(size(dataArray{1},1),size(dataArray,2)); for col=[1,2,3,4,5,6,7] % Converts text in the input cell array to numbers. Replaced non-numeric text with NaN. rawData = dataArray{col}; for row=1:size(rawData, 1) % Create a regular expression to detect and remove non-numeric prefixes and suffixes. regexstr = '(?.*?)(?([-]*(\d+[\,]*)+[\.]{0,1}\d*[eEdD]{0,1}[-+]*\d*[i]{0,1})|([-]*(\d+[\,]*)*[\.]{1,1}\d+[eEdD]{0,1}[-+]*\d*[i]{0,1}))(?.*)'; try result = regexp(rawData(row), regexstr, 'names'); numbers = result.numbers; % Detected commas in non-thousand locations. invalidThousandsSeparator = false; if numbers.contains(',') thousandsRegExp = '^[-/+]*\d+?(\,\d{3})*\.{0,1}\d*$'; if isempty(regexp(numbers, thousandsRegExp, 'once')) numbers = NaN; invalidThousandsSeparator = true; end end % Convert numeric text to numbers. if ~invalidThousandsSeparator numbers = textscan(char(strrep(numbers, ',', '')), '%f'); numericData(row, col) = numbers{1}; raw{row, col} = numbers{1}; end catch raw{row, col} = rawData{row}; end end end %% Replace non-numeric cells with NaN R = cellfun(@(x) ~isnumeric(x) && ~islogical(x),raw); % Find non-numeric cells raw(R) = {NaN}; % Replace non-numeric cells %% Create output variable jro19661111 = table; jro19661111.YEAR = cell2mat(raw(:, 1)); jro19661111.MONTH = cell2mat(raw(:, 2)); jro19661111.DAY = cell2mat(raw(:, 3)); jro19661111.HOUR = cell2mat(raw(:, 4)); jro19661111.MIN = cell2mat(raw(:, 5)); jro19661111.GDALT = cell2mat(raw(:, 6)); jro19661111.NE8 = cell2mat(raw(:, 7)); malak奥萨马 //www.tianjin-qmedu.com/matlabcentral/profile/authors/20681547 标签:www.tianjin-qmedu.com, 2005:问题/ 1455204 2021-09-17T07:36:49Z 2021 - 09 - 17 - t10:45:17z 基于某些标准创建一个函数 假设我想创建一个函数:y=x^2 for x>5 x^3 for 0 Deepro巴德汉 //www.tianjin-qmedu.com/matlabcentral/profile/authors/19233537 标签:www.tianjin-qmedu.com, 2005:问题/ 1454929 2021 - 09 - 16 - t18:35:25z 2021 - 09 - 16 - t18:45:39z 将字符串转换为数字 嘿,我遇到麻烦了。我必须转换一个字符串(200x1),每行有四个数字:0000 0001 0002 0003 ... ... ...对数字,才能做运算。我使用了str2num,但出现了错误:输入必须是字符向量或字符串标量。 韦森特Noguer //www.tianjin-qmedu.com/matlabcentral/profile/authors/21533143 标签:www.tianjin-qmedu.com, 2005:问题/ 1454754 2021 - 09 - 16 - t15:01:57z 2021 - 09 - 16 - t15:01:57z 在fzero中使用函数 我要求的是Smax*F(b)*根号(b/0.4) - Kic = 0时的b值。F(b)是一个函数,它根据b给出一个插值值。带有interval的代码行和我调用fzero的代码行是这样的:公元前= fzero (@ (b) Smax * F (b) * sqrt (b / 0.4)断裂韧性,est_bc);这给我错误使用f0(第290行)函数值在区间端点必须不同的符号。非常感谢您的回答! 西蒙必 //www.tianjin-qmedu.com/matlabcentral/profile/authors/12538604 标签:www.tianjin-qmedu.com, 2005:问题/ 452570 2019 - 02 - 06 - t05:00:00z 2021 - 09 - 16 - t13:58:38z 如何在生成的代码中更改子系统函数的名称? 我想更改子系统生成的函数的函数签名,特别是名称,以便我可以从代码的其他部分调用它。 MathWorks支万博1manbetx持团队 //www.tianjin-qmedu.com/matlabcentral/profile/authors/4622813 标签:www.tianjin-qmedu.com, 2005:问题/ 1454389 2021 - 09 - 16 - t09:27:57z 2021 - 09 - 16 - t09:27:57z 限定隐式三维函数的取值范围 我是MATLAB新手,一直在使用MATLAB作为隐式函数来渲染器官形状,如肾脏和膀胱。我试着用椭圆函数模拟膀胱形状,这个隐式函数看起来是这样的:膀胱2d=@(x,y)(y.^2-(x-0.5)。^(3)+2*(x-0.5)-1;fimplicit(bladder2D)如果我使用以下函数,它会将2D层“堆叠”为3D形状,该形状遵循h=fimplicit3(@bladder2);设置(h,'EdgeColor','none','MeshDensity',110);zlim([0,4*pi])视图(-130,30)函数out=bladder2(x,y,z)bladder1=@(x,y)(y.^2-(x-0.5)。^(3)+2*(x-0.5)-1.*(pi*z-z.^2)。^(1/2);s=@(q)min(q./(pi*z-z.^2)。^(1/2),1e6);out=膀胱1(s(x),s(y));最后,有两个问题需要解决:一个是我想将“bladder2D”函数限制在周围,这样当渲染到3D时,它就会变成一个膀胱形状。关键是x值不能以3D形式限制;它应该以2D形式完成。另一个问题是,在膀胱形状的顶部有一个“孔”,希望移除这个“孔”。如何解决这些问题? 승준이 //www.tianjin-qmedu.com/matlabcentral/profile/authors/23720382 标签:www.tianjin-qmedu.com, 2005:问题/ 1454129 2021 - 09 - 16 - t01:15:50z 2021 - 09 - 16 - t01:53:01z 为什么MATLAB用这个函数产生错误的输出? 使用这些分段函数,我试图找到v(x)也就是函数中的beamDef,给定用户输入的x值,也就是beamLoc。函数[beamDef] = FindDeflection(beamLoc) A = (1/3.19e9);x1 = (beamLoc > 0) & (beamLoc < = 120);x2 = ((beamLoc > 120) & (beamLoc < = 240));x3 = ((beamLoc > 240) & (beamLoc < = 360));beamDef = * ((800 * (x1。^ 3))-(13.68 *(10 ^ 6)。* x1) - (2.5 * (x1。^ 4)));beamDef = * ((800 * (x2。^ 3))-(13.68 *(10 ^ 6)。* x2) - (2.5 * ((x2。^ 4))+ (2.5 * (x2 - 120)。^ 4)));beamDef = * ((800 * (x3。^ 3))-(13.68 *(10 ^ 6)。* x3) - (2.5 * ((x3。^ 4))+ (2.5 * (x3 - 120)。^ 4))+(600。* ((x3 - 240)。^ 3)));当我尝试在我的主脚本上测试当beamLoc = 115时,它给我一个beamDef = -2.763,而实际上它应该是-0.249。我已经尝试过用许多不同的方法重写方程,但我仍然不能让MATLAB产生正确的输出。 加文·汤普森 //www.tianjin-qmedu.com/matlabcentral/profile/authors/23566460 标签:www.tianjin-qmedu.com,2005:Question/1453694 2021 - 09 - 15 - t11:41:01z 2021 - 09 - 15 - t11:56:28z matlab代码最小二乘法 y = 11.89, 2.01, 4.54, 7.26, 1.61, 3.99, 7.16, 11.17, 10.44, 1.97 y(x) = c1x + c2x^(2/3) + c3xsin(x) avebAragorn //www.tianjin-qmedu.com/matlabcentral/profile/authors/20414575 标签:www.tianjin-qmedu.com,2005:Question/1453324 2021 - 09 - 14 - t23:04:40z 2021 - 09 - 15 - t02:56:33z 弹丸运动的分析和数值分析。 有人可以帮助我解决这个功能吗?我的最后一个绘图没有绘制曲线。%% HW3弹丸运动清除;CLC %%实验A = -9.8;%重力n = 1;%间隔tt = 10;%总时间t = 0:n:tt;%时间%等式x = t;yy = a *(t);%f = m * a(t)忽略质量%%分析分析%下降物体而没有任何阻力系数和空气密度%图速度与时间%%输入H = 1; %step size tl=0; %lower bound th=10; %upper bound vg=100; %initial velocity of golf ball (m/s) %% establish domain t=[tl:h:th]; %independent variable (time) v= zeros(1,length(t)); %dependent variable (velocity) %% initial condition y(1)=vg; %% constants mg=1; %mass of golf ball g=-9.8; %gravity %% define function ODE f=@(t,y) mg.*g; %Newton's Second Law equation is f=m.*a %loop over N for i=1:length(t)-1 % t(i+1)=t(i)+h; %Euler's Method y(i+1)=y(i)+f(t(i),y(i)).*h; end %% Numerical Analysis %consist of air density, cross sectional area, and Drag Coefficient of %object %% inputs h=0.5; %step size tl=0; %lower bound th=10; %upper bound vg=100; %initial velocity of golf ball (m/s) %% establish domain t=[tl:h:th]; %independent variable (time) v= zeros(1,length(t)); %dependent variable (velocity) %% initial condition y(1)=vg; %% constants mg=2; %mass of golf ball g=-9.8; %gravity rho=1.225; %air density Cg=0.47; %drag coefficient of a sphere Ag=0.005; %cross-sectional area of golf ball %% define function ODE f=@(t,y) mg.*g; %Newton's Second Law equation is f=m.*a %loop over N for i=1:length(t)-1 % t(i+1)=t(i)+h; %Euler's Method y(i+1)=y(i)+f(t(i),y(i)).*h; end fn=@(t,y) ((1/2.*mg).*(rho).*(Cg).*(Ag).*(vg.^2))+g; for i=1:length(t)-1 yn(i+1)=y(i)+fn(t(i),y(i)).*h; end %% Plots figure(1); clf(1) plot(x,yy,'-.dr'); hold on plot(t,y,'-o') hold on plot(t,yn,'--x') title('Experimental and Analytic Analysis of a falling golf ball') xlabel('Time (s)') ylabel('Velocity (m/s)') xlim([0 20]) ylim([0 25]) 亚历山大fastiggi //www.tianjin-qmedu.com/matlabcentral/profile/authors/16032059 标签:www.tianjin-qmedu.com, 2005:问题/ 1453154 2021 - 09 - 14 - t15:41:48z 2021 - 09 - 14 - t18:03:38z 不断获得“太多的输入参数” 你好,我一直得到错误使用lm25119_calcs/HsFETlosses太多的输入参数。a = lm25119_calcs b = a.s hsfetlosses (a,1) L McKeehan //www.tianjin-qmedu.com/matlabcentral/profile/authors/23843899 标签:www.tianjin-qmedu.com, 2005:问题/ 1452919 2021 - 09 - 14 - t10:08:37z 2021 - 09 - 14 - t12:59:17z 按连接行元素的第一列对矩阵进行排序,以便第二列的元素“跟随”第一列的元素。 大家好,我有一个两列矩阵,第一列是一些粒子的直径,第二列是Extiction。因此,第二列的元素对应于第一列的元素。我的问题是,是否有一个函数可以让我按升序或降序(无关紧要)对第一列进行排序,以便相应的extiction值“跟随”?非常感谢你。 亚历克斯·佩拉基斯 //www.tianjin-qmedu.com/matlabcentral/profile/authors/3426482 标签:www.tianjin-qmedu.com, 2005:问题/ 1452889 2021 - 09 - 14 - t09:33:38z 2021 - 09 - 14 - t12:53:07z 欧拉ODE转换为MATLAB代码 嘿,大家好!我有一个关于欧拉方法实现的问题。我有如下函数:(1)我写了它的主要函数代码为:function y = eulerfunction(func, t, y0) n = length(t);Y = nan(length(y0), n);y (: 1) = y0 (:);对于k = 1:n-1 h = t(k+1) - t(k);Y (:,k+1) = Y (:,k) + h*func(t(k), Y (:,k));现在我正在写剩下的脚本。y0 = [3,0];h = 0.5; t = 0; % I am confused in this line that what to write in these square brackets according to the given equation (1) f = @(t, y) [ ]; y = eulerfunction(f, t, y0) Can you please help me to convert that f(t,y) in MATLAB Format? Like what to write in these brackets '[ ]' according to the f (t,y) in above equation (1): f = @(t, y) [ ]; Any help will be really appreciated! Thanks alot in advance. 阿里 //www.tianjin-qmedu.com/matlabcentral/profile/authors/22836834 标签:www.tianjin-qmedu.com, 2005:问题/ 423270 2018-10-10T15:00:54Z 2021 - 09 - 14 - t11:43:14z 如何在MATLAB Android应用程序中做一个函数并回忆它 现在我没有一个pc访问,所以我安装MATLAB在我的标签(Android),所以我面临一个问题,不能使一个功能,并在编辑器中使用它。 艾哈迈德sleem //www.tianjin-qmedu.com/matlabcentral/profile/authors/13202017 标签:www.tianjin-qmedu.com,2005:Question/1452804 2021 - 09 - 14 - t08:06:10z 2021-09-14T11:36:36Z 如何为许多参数找到函数? 让一个= randperm (16);一个=重塑(4,4);我有如下函数函数[B]=fun(A, A, B,c) B= A *A+ B *A+c。*结束现在我想找到B与不同的参数,B, c 1, 2, 3, 1, 3, 4 7日5一套我可以找到[B] =乐趣(,1、2、3),但我有很多参数,有什么方法可以将参数保存在一个separte文件并运行这些代码并保存所有结果。 努尔Bano //www.tianjin-qmedu.com/matlabcentral/profile/authors/11967560 标签:www.tianjin-qmedu.com, 2005:问题/ 1444694 2021-09-01T12:36:30Z 2021 - 09 - 14 - t10:46:40z 如何使用for循环从多个不同的日子检索数据? 我有一个函数,可以从想要查看的日期检索数据。我想画一幅全年温度随时间变化的曲线图。函数[lon,lat,t,z,t,S,u,v]=读取数据集(yr,mon,dy)我想知道如何使用此函数从2015-08-29到2017-07-31每天运行一次。我已经试着做了一个for循环,但是我现在被卡住了,因为它是三个不同的输入参数。 海森堡先生 //www.tianjin-qmedu.com/matlabcentral/profile/authors/11935060 标签:www.tianjin-qmedu.com,2005:Question/1452899 2021 - 09 - 14 - t09:58:47z 2021 - 09 - 14 - t09:58:47z 状态事件-在特定时间值后更改解决方案的功能 大家好!我在用MATLAB做一个大学项目,我有下面的问题:我有两个相似的函数我们叫它们a和b。它们之间唯一的区别是“b”由同一个方程中的一个额外的常数参数组成。在开始的时候,函数a被调用,然后进行积分。在一个特定的时间值之后(例如:t =200s),程序应该停止使用'a'作为解,并继续与'b'集成。是否可以通过使用状态事件来实现?如果可以,那么如何实现呢?如果你能帮我做那件事,我将非常感激。 用途:Gergely //www.tianjin-qmedu.com/matlabcentral/profile/authors/21690741 标签:www.tianjin-qmedu.com, 2005:问题/ 1452514 2021 - 09 - 13 - t21:32:14z 2021 - 09 - 13 - t22:52:26z 我如何使用函数的输出值在脚本中绘制这些值 我想调用我的函数(在脚本中)并从函数的特定输出绘制向量。函数代码:(这似乎是完美的工作,因为它意味着输出时间,速度,和质量向量给定:delt(步长)和t_end(结束时间)。函数[t,m,v] = rocket_euler(delt,t_end) %rocket_euler用欧拉法求解t,v,m向量g = 9.81;%重力(m/s^2) c = 25000;%推力常数(m/s) t = 0: delta:t_end;%time vector from 0 to t_end seconds t(1) = 0;%初始时间设置为0 (s) m(1) = 1000000;%燃料初始质量(kg) v(1) = 0;长度(t)-1 DMDT = -4000时,火箭初速度(m/s) %;m(ii+1) = m(ii) + (dmdt*delt); %update law for Euler's Method dvdt = -g - ((c*dmdt)/(m(ii))); %solve given formula for dvdt or acceleration v(ii+1) = v(ii) + (dvdt*delt); %update law for Euler's Method end end Here is my script: (120s is always the value used for t_end while delt (step size) changes from 60 to 30 to 15 and to 5) I want to plot the different lines it makes (due to changes in step size) on a single plot. clc; clear; %clears workspace and command window plot(t = rocket_euler(60,120),v = rocket_euler(60,120),'.-','color',[0 0 1],'Marker','*','markersize',15,'linewidth',1.5) %plot t vs v legend('Step Size: 60s'); %step size of 60s hold on %prevent overwrite of plot plot(t = rocket_euler(30,120),v = rocket_euler(30,120) ,'.-','color',[0 1 0],'Marker','x','markersize',15,'linewidth',1.5) %plot t vs v legend('Step Size: 30s'); %step size of 30s hold on %prevent overwrite of plot plot(t = rocket_euler(15,120),v = rocket_euler(15,120) ,'.-','color',[1 0 0],'Marker','o','markersize',15,'linewidth',1.5) %plot t vs v legend('Step Size: 15s'); %step size of 15s hold on %prevent overwrite of plot plot(t = rocket_euler(5,120),v = rocket_euler(5,120) ,'.-','color',[0 1 1],'Marker','+','markersize',15,'linewidth',1.5) %plot t vs v legend('Step Size: 5s'); %step size of 5s xlabel('t (seconds)') %add x-label ylabel('v (m/s)') %add y-label t = rocket_euler(60,120),v = rocket_euler(60,120) The above snippet of code is where I believe I am going wrong. Same for each line that begins with "plot(..." 诺兰汉斯莱 //www.tianjin-qmedu.com/matlabcentral/profile/authors/21007964 标签:www.tianjin-qmedu.com, 2005:问题/ 1452509 2021 - 09 - 13 - t21:14:53z 2021 - 09 - 13 - t21:14:53z 如何实现meijerG的功能 你好!怎么样了 ?我正在解决一个科学的文章,我发现自己有困难。这里有人有Meijerg功能的域名吗?我已经阅读了Matlab的文档,但事实是它不是很清楚。例如,在文档中,它看起来像这个meijerg(a,b,c,d,z),根据该函数的一般定义,与图中出现的输入变量相对应的输入变量是什么? Fidele Adanvo //www.tianjin-qmedu.com/matlabcentral/profile/authors/11691795 标签:www.tianjin-qmedu.com, 2005:问题/ 1450079 2021 - 09 - 09 - t14:54:46z 2021-09-12T15:41:11Z 从.m脚本调用应用程序设计器函数 你好,伙计们,首先要描述这种情况:我有在App Designer和Matlab .m脚本中制作的GUI。这两者在没有问题的情况下在一起和交易变量。我的问题是我想调用来自.m脚本文件的AppDesigner中的函数。情况:从GUI用户按下按钮,按钮将启动与执行器的通信。然后将由.m脚本处理此通信我希望在appdesigner中调用函数,这将从脚本中获取接收的数据并使用它们。我无法在任何地方找到这个问题,我只发现它从其他方向解决了(来自appdesigner的脚本/函数)我确实尝试了这个:gui = gui;gui.readerrorbutton.buttonpushedfcn();- >错误:类别'GUI'的未被识别的方法,属性或字段'Readerrorbutton'。我在调试期间检查功能时获取此信息:val = @(源,事件)trycallback(appdesigner.internal.service.appmanagementservice.instance(),app,callback,carryeventdata,事件)任何帮助感谢,谢谢,谢谢大卫 大卫Cervinek //www.tianjin-qmedu.com/matlabcentral/profile/authors/20158796 标签:www.tianjin-qmedu.com, 2005:问题/ 1451609 2021 - 09 - 12 - t11:20:28z 2021 - 09 - 12 - t12:01:53z 我如何把函数的输出矩阵组合成一个矩阵? function [] = integrateQuaternions(BR,EA) % Parameters A = 0;初始条件(角减半,用弧度表示)B = 0;C = -45 * (pi/180);P = 0 * (pi/180);%身体比率在弧度(0)q = 5.5 * (pi/180);%(5。N8 deg/s) r = 3.5 *(pi/180);% ((1+0.5*N9) deg/s) BR = [p q r];EA = [0 0 (-45*(pi/180))];初始姿态q0 = i.*(cosd(C)*cosd(B)*cosd(A) + sind(C)*sind(B)*sind(A)); q1 = i.*(cosd(C)*cosd(B)*sind(A) - sind(C)*sind(B)*cosd(A)); q2 = i.*(cosd(C)*sind(B)*cosd(A) + sind(C)*cosd(B)*sind(A)); q3 = i.*(-cosd(C)*sind(B)*sind(A) + sind(C)*cosd(B)*cosd(A)); Q = [q0 q1 q2 q3]; %Euler Interation q0dot = i.*(-0.5*((q1*p)+(q2*q)+(q3*r))); q1dot = i.*(0.5*((q0*p)-(q3*q)+(q2*r))); q2dot = i.*(0.5*((q3*p)+(q0*q)-(q1*r))); q3dot = i.*(-0.5*((q2*p)-(q1*q)-(q0*r))); % Normalizing Qdot = [q0dot q1dot q2dot q3dot]; mu = sqrt(q0^2 + q1^2 + q2^2 + q3^2); qnplus1 = Q + Qdot; Qx = (qnplus1./mu); Qfinal = [Qx] end end My function is working correctly as it gives the matrices I want, although I'd like to combine them into a single output matrix but am not sure how to. Any advice would be greatly appreciated! 凸轮 //www.tianjin-qmedu.com/matlabcentral/profile/authors/23620297 标签:www.tianjin-qmedu.com, 2005:问题/ 1451534 2021 - 09 - 12 - t07:33:39z 2021 - 09 - 12 - t10:01:18z 从另一个.m文件调用函数 试图从另一个名为stringorder的文件调用函数。但是出错了,有人能解释一下原因吗?谢谢你!这是函数文件函数f = ["Benn";“丹”;“勒布朗”;“吉姆”;“玫瑰”);这是我的脚本函数A = stringorder;[M, N] =大小(一个);for i = 1:M-1 for j = 1:M-1 next = A(j+1); if upper(curr) > upper(next) A(j) = next; A(j+1) = curr; end end end disp(A); 乔·安斯沃思 //www.tianjin-qmedu.com/matlabcentral/profile/authors/23724687 标签:www.tianjin-qmedu.com, 2005:问题/ 1451014 2021-09-11T03:04:19Z 2021 - 09 - 12 - t03:00:44z 模拟自由落体工程,ode45,用雷诺求阻力系数,递归问题 这似乎是一个递归问题;我需要速度来计算雷诺数;ODE45似乎不需要使用递归;现在我不能从这个代码得到任何结果。请给我一些建议;谢谢你!关闭所有;清除所有;clc;tr = [0 15]; %seconds initv=[0 0]; %start 600 m high [t,y,Re]=ode45(@rkfalling, tr, initv) plot(t,y(:,1)) ylabel('x (m)') xlabel('time(s)') figure plot(t,y(:,2)) ylabel('velocity (m/s)') xlabel('time(s)') % figure % plot(t,Re) % figure % plot(t,Drag_force) function [dwdt, Re, Drag_force]=rkfalling(t,w) g=9.81; % air density @ standard sea-level condition kg/m3 rou_air = 1.294; % air viscosity, Pa*s mu = 17.2e-6; radius = 0.01; rou = 7750; volume_sphere = 4/3*pi*radius^3; mass =rou*volume_sphere; %displacement y = w(1); %velocity ydot = w(2); %Re = w(3); dwdt=zeros(size(w)); dwdt(1) = ydot; % drag force % Reynolds number Re = rou_air*radius*2*ydot/mu; %Re=5000; % drag coefficient C_D = 24/Re + 2.6*(Re/5.0)/(1+(Re/5.0)^1.52)+0.411*(Re/2.63e5)^(-7.94)/(1+(Re/2.63e5)^(-8.0))+0.25*(Re/1e6)/(1+(Re/1e6)); Drag_force = C_D*0.5*rou_air*pi*radius*2*ydot^2; %dwdt(2)= -0.2*ydot^2+g; dwdt(2)= -Drag_force/mass+g; end 雷丽 //www.tianjin-qmedu.com/matlabcentral/profile/authors/22001023 标签:www.tianjin-qmedu.com, 2005:问题/ 93675 2009 - 06 - 27 - t01:11:00z 2021 - 09 - 11 - t10:38:21z 是否有可能从MATLAB调用Excel宏函数? 我想从MATLAB调用Excel宏函数。 MathWorks支万博1manbetx持团队 //www.tianjin-qmedu.com/matlabcentral/profile/authors/4622813 标签:www.tianjin-qmedu.com, 2005:问题/ 1450824 2021 - 09 - 10 - t16:55:17z 2021 - 09 - 10 - t21:37:23z 求从1到25的所有数的可整除性 你好,我试图得到一个函数,可以找到1到25到3和5的可整除性1不能被3或5整除2不能被3或5整除…24能被3整除25能被5整除,我没有做过任何函数,因为我不擅长matlab,但我有一个想法,用函数和循环来循环每个数的可整除性,因为它们不断从最后一个数加1 卡斯滕陈 //www.tianjin-qmedu.com/matlabcentral/profile/authors/23411945 标签:www.tianjin-qmedu.com, 2005:问题/ 1448559 2021 - 09 - 07 - t17:34:35z 2021 - 09 - 10 - t13:47:37z 如何将输入变量声明为向量? 给定的函数(y1,……在matlab中,输入变量x1可能是一个向量吗? Fidele Adanvo //www.tianjin-qmedu.com/matlabcentral/profile/authors/11691795 标签:www.tianjin-qmedu.com, 2005:问题/ 1448334 2021 - 09 - 07 - t12:53:43z 2021 - 09 - 10 - t10:43:45z 我如何创建一个数组的函数与for循环? 你好,我想找一个更短更简单的计算。我总共有42个424x412的double,我想为它们计算所有元素的均值,并构建一个结果数组,该数组将是42x1。因为我必须多次计算这样的数组(我已经为42个数组的多个集合做了这个),我更喜欢在for循环中这样做。到目前为止,我已经尝试了以下方法,这并不适用于k = 1:42 B = mean('X(k)','all') end;谁能帮帮我?我是一个MATLAB新手!: D Jooris价格 //www.tianjin-qmedu.com/matlabcentral/profile/authors/21443424 标签:www.tianjin-qmedu.com, 2005:问题/ 1450314 2021 - 09 - 10 - t00:24:13z 2021 - 09 - 10 - t06:14:16z 左右索引不兼容 所以我做了一个剪力图,但现在我试图添加一个弯矩/最大弯矩的图,但我一直得到的信息“无法执行分配,因为左边的指标与右边的大小不兼容。”,我尝试改变Big Bend和BendL的方式,但没有运气。场景:床是8英尺长,两端有一个支撑,男人是180磅的%沿着床展开男人= 180;万博1manbetx%lb床长= 8;%ft Ysum = 0;% Y方向荷载之和=(人/床长)%分布荷载Aforce =(人/床长)*(0.5 *床长)for Blength = [1:8] Force(Blength) = Aforce - load * Blength % shear diagram end Number for shear diagram Xplot = [1:8] plot (Xplot, Force) % shear Force plot title ' shear Force diagram ' xlabel 'Bed Length (ft)' ylabel 'Force (lb)' hold on for BendL = [1:8] %since load均布弯矩(BendL) =力* BendL端部图(1:床身长度/2,弯矩) BoostedMan //www.tianjin-qmedu.com/matlabcentral/profile/authors/19413481 标签:www.tianjin-qmedu.com, 2005:问题/ 1450294 2021 - 09 - 09 - t21:42:44z 2021 - 09 - 09 - t22:18:49z 使用ReliefF功能进行特征选择 您好,我正在大约700个功能中使用ReliefF功能选择(1个表列是一个功能)。我得到一个错误,我应该提供一个数字X。但是,X总是双精度的。fscmrmr函数工作得很好,所以我不知道relieff为什么不工作。[idx,权重]=relieff(FeaturesData(:,2:700),ScoreData,10);%使用relieff时出错(第86行),您必须提供数字X.bar(权重(idx));idx(1:10);xlabel(“预测秩”);ylabel(“预测重要性权重”);信息:分数数据:422×1双倍值:最小值1中位数5最大值5特征1平均值:422×1双倍值:最小值-27.801中位数-0.064483最大值22.406特征2。。。提前谢谢你! 尼娜性能 //www.tianjin-qmedu.com/matlabcentral/profile/authors/23020446 标签:www.tianjin-qmedu.com, 2005:问题/ 1449594 2021 - 09 - 08 - t22:06:44z 2021-09-09T13:24:52Z >>日期必须是数字标量、字符向量或字符串标量。 我试图在Matlab中有下面的日历,但我得到了一些错误消息,我加入了我使用的错误消息的函数 Mostafa El-Abboubi //www.tianjin-qmedu.com/matlabcentral/profile/authors/18630927 标签:www.tianjin-qmedu.com,2005:Question/1449189 2021 - 09 - 08 - t12:03:52z 2021 - 09 - 09 - t09:48:11z 有没有更好的方法来使用cellfun与争论?它比for循环好吗? 嘿,当我使用Cellfun时,使用具有参数的函数,我使用Repmat函数来复制我的参数。我的问题是,如果有更好的方法来做到这一点。以下是一个例子,假设我有一个营业单元格数组,我想在每个%中获得尺寸1的大小,创建一个小区数组,随机值Randval = @(x)魔术(randi(5,2))cellarr= Arrayfun(RANDVAL,ONE(10,1),'统一输出',false);%获取单元格中的每个元素的第一大小的大小= Cellfun(@ size,Cellarr,Repmat({1},大小(Cellarr,1),1));这是我询问的部分:Repmat({1},大小(Cellarr,1),1)有更好的方法来做到这一点吗?通常,使用for-loop更好的是更好的吗? ytzhak goussha //www.tianjin-qmedu.com/matlabcentral/profile/authors/11482545 标签:www.tianjin-qmedu.com, 2005:问题/ 1449394 2021 - 09 - 08 - t16:09:20z 2021-09-09T09:26:12Z 在Matlab中进行多次求和最有效的方法是什么? 最近我遇到了一个关于Matlab中的多次求和计算的问题。如下面的表达式所示,我想数值计算y w.r.t.x和k。之前,我以嵌套方式使用函数“symsum”来获得y的解析表达式,而不使用求和符号,然后对表达式进行数值计算,但计算将花费大量时间(最多几天)。因此,我想知道是否还有其他更有效的方法可以做到这一点,比如向量化多重求和(我不知道如何向量化),或者使用其他函数,比如bsxfun(据说这个函数在循环方面很有效?)或者cumsum?提前感谢您的帮助! 双峰江 //www.tianjin-qmedu.com/matlabcentral/profile/authors/14216283 标签:www.tianjin-qmedu.com, 2005:问题/ 1449669 2021 - 09 - 09 - t01:13:30z 2021 - 09 - 09 - t07:02:01z 函数内部的变量 早上好,我runnung迭代循环回路(arg)参数是一个数字来指定matlab运行多少次循环(arg)有一些函数内循环(arg)运行模拟和紧随其后的趋同标准在一个循环(arg)我的问题是我需要提取全局变量rxf分配和礼物在一个循环(arg)中使用在该函数中执行loop(arg)的函数。但我观察到错误未识别的函数或变量'rxf'。你知道如何解决这个问题吗?先谢谢你。 拉凯什·库马尔·托塔 //www.tianjin-qmedu.com/matlabcentral/profile/authors/17625888 标签:www.tianjin-qmedu.com,2005:Question/96005 2012 - 02年- 27 - t22:41:00z 2021 - 09 - 09 - t06:16:06z 为什么会出现“未定义函数或变量”错误? 我收到以下错误消息之一。我该如何解决这个问题?未定义功能或变量。无法识别的功能或变量。未定义的函数或方法。 MathWorks支万博1manbetx持团队 //www.tianjin-qmedu.com/matlabcentral/profile/authors/4622813 标签:www.tianjin-qmedu.com, 2005:问题/ 1448614 2021 - 09 - 07 - t19:51:02z 2021 - 09 - 08 - t16:32:01z 如何使一个函数适应两点的变化? 假设您在Excel中定义了一个函数,并使用cftool将数据拟合到一条多项式曲线上。现在你只需要改变函数的两个点,从(x,y)_original到(x,y)_new。你想让函数的其余部分适应这种变化。怎么做呢?现在是这样的:我有一个合理的符合9系数(第五力量分子和分母第五力量,5系数在分子和分母4系数x ^ 5在分母上的系数是1),我可以,但是,选择不同的适应(正弦多项式,等等)如果这里将帮助。我已经试过随机改变两个系数来迫使函数适应这两个新点,但它产生了一些没有意义的东西。这是我所拥有的:这是一个合理的适合于用Matlab cftool生成的Excel数据集:p2 = 0.8033;p3 = 2.654;p4 = 4.375; p5 = 3.691; p6 = 1.221; q1 = 6.399; q2 = 21.65; q3 = 34.98; q4 = 29.02; q5 = 9.704; m = (x - 0.9857)./0.1235; y = (p1*m.^5 + p2*m.^4 + p3*m.^3 + p4*m.^2 + p5*m + p6) ./ (m.^5 + q1*m.^4 + q2*m.^3 + q3*m.^2 + q4*m + q5); ``` I need to make the function go through points (0.78; 0.002) and (1.05473536553; 9.869964329717e-2), while keeping the shape. 丹尼尔·鲍威尔 //www.tianjin-qmedu.com/matlabcentral/profile/authors/9391201 标签:www.tianjin-qmedu.com,2005:Question/1448414 2021-09-07T15:01:39Z 2021-09-08T16:11:05Z 输入参数不足。 亲爱的大家,我希望你们有一个伟大的一天。我发现一个代码附在一个研究,他的开发人员建议,是关于模拟生化过程的工作。然而。当尝试运行它时,我发现了一些问题。一是当我运行以下函数函数y1 = ADDE(t,y) y1 = 0 (size(y));等给出y1(元素)的方程时,会出现“输入参数不足”的错误。我应该先定义y吗?因为它没有在原始代码中执行。谢谢 穆罕默德Eisa //www.tianjin-qmedu.com/matlabcentral/profile/authors/8841600 标签:www.tianjin-qmedu.com, 2005:问题/ 1449164 2021 - 09 - 08 - t11:37:04z 2021 - 09 - 08 - t12:21:01z 替换函数中的for循环 有人能帮我删除下面函数中的for循环,并得到与循环相同的结果吗?提前感谢你。函数I = func(f, a, b, n) %添加描述,名称,日期,输入,输出我= 0;For j = 1:n x = a + (j-0.5)*h;I = I + h*f(x);结束结束 阿里 //www.tianjin-qmedu.com/matlabcentral/profile/authors/22836834 标签:www.tianjin-qmedu.com, 2005:问题/ 1448504 2021-09-07T16:28:40Z 2021 - 09 - 08 - t11:22:01z 在所有子文件夹上运行函数,并保存为单独的结构体 我构建了一个函数,允许我使用uigetdir选择一个文件夹,并处理位于其中的所有数据文件。它使用一些.txt文件并将相关数据保存到一个结构体中。我遇到的问题是这个函数一次只针对一个文件夹;我通常将数据保存在一个主文件夹中,其中有几个子文件夹,这些子文件夹是根据更改的测试变量命名的,我不想在所有子文件夹上手动运行函数。例如:Main folder = testnumber1,在Main folder里面有几个名为pressure1, pressure2,等等的子文件夹(多达20个文件夹)。我要做的是选择Main folder (testnumber1),用一个递归函数调用,让我得到多个struct,标签是pressure1, pressure2,等等。我已经设置了函数,但我不知道如何自动化它,并将信息保存到标记有文件夹名称的结构体。 史密斯先生 //www.tianjin-qmedu.com/matlabcentral/profile/authors/22948853 标签:www.tianjin-qmedu.com,2005:Question/1448419 2021 - 09 - 07 - t15:01:44z 2021 - 09 - 08 - t09:41:37z 调用函数期间未分配变量 大家好,我有一段代码,其中我使用一个函数来计算一个值。这个值是在一个函数中获得的,在那个函数中,MATLAB说输出参数没有被赋值。这里是函数的一个简单版本(我已经从函数中删除了所有不感兴趣的东西):function [Gray_scale] = GrayScaleSlider2(I) % Create ValueChangingFcn callback function sliderMoving(event,TextH,im) Gray_scale = event. value;在调用“GrayScaleSlider2”期间没有分配输出参数“Gray_scale”(可能还有其他参数)。错误在MenisciTracker(第78行)[Gray_scale] = GrayScaleSlider2(test_image1_七分);我如何得到函数返回计算值?谢谢你的帮助!最好的问候,鲁迪 鲁迪Lagraauw //www.tianjin-qmedu.com/matlabcentral/profile/authors/22385522 标签:www.tianjin-qmedu.com,2005:问题/ 1447864 2021 - 09 - 06 - t17:57:55z 2021 - 09 - 06 - t18:37:36z 有人可以解释为什么我收到错误“没有足够的输入参数(第2行)”? mysvmfun(x) = mysvmfun(x);有趣= @ (x) mysvmfun (x);xvar = optimizableVariable(“xvar2”,[1,30],“类型”,“整数”);yvar = optimizableVariable(“yvar2”,[1,30],“类型”,“整数”);x = [xvar yvar];结果= bayesopt(有趣,x); Avish Naredi //www.tianjin-qmedu.com/matlabcentral/profile/authors/13840148 标签:www.tianjin-qmedu.com,2005:Question/1447874 2021 - 09 - 06 - t17:58:37z 2021 - 09 - 06 - t18:31:19z 在GA中使用带有用户定义变量的函数 你好每一个人我有一个做一些计算功能在一个很大的矩阵(42588 x17)这个矩阵来自进口的excel文件readmatrix功能本身运行需要小于2 secound这样FileContent = readmatrix (Export.xlsx)函数z = myfun (x, FileContent)。函数z=myfun(x) FileContent=readmatrix("Export.xlsx") . .现在我想为变量x运行GA在这个函数上,但我如何做它而不运行readmatrix在每次运行我尝试了全局变量,但它对我不起作用 穆罕默德Kalantar //www.tianjin-qmedu.com/matlabcentral/profile/authors/11750539 标签:www.tianjin-qmedu.com, 2005:问题/ 362812 2017 - 10 - 23 - t17:04:46z 2021 - 09 - 06 - t14:06:07z 如何计算分配给'sym'的函数的最大值? 我解了一个微分方程,并把解存储在y中,类型是'sym'。但是我不能用max函数。下面的代码:- eqn = ' Dy + y /(8 *(10 ^ 5) * 5 *(10 ^(6))) = 12 /(8 *(10 ^ 5))”;init = y(0) = 0的;init, y = dsolve (eqn ' t ');溶液= [y (t) =, char(简化(y)));ezplot(y) max(y) dy=diff(y);max(dy) 'max'函数不工作。 Debashish雷 //www.tianjin-qmedu.com/matlabcentral/profile/authors/11320445 标签:www.tianjin-qmedu.com,2005:Question/1447079 2021 - 09 - 05 - t12:58:47z 2021 - 09 - 06 - t08:59:32z 如何修复"错误使用类。输入参数不够? 将此功能代码写为工作表的一部分。它正常工作,但突然间我收到了错误消息。我没有改变任何事情,所以我没有Clue这么发生这种情况?%从分类器[opset,offset] = change_times(类,时间)中找到对应于开始和偏移时间的时间点;(出错在上面的行后)%显示使用每个分类器长度(开未启用)确定的开始/偏移量的数量;disp(['onset times =',num2str(lengthset)),])长度(偏移);disp(['offset times =',num2str(长度(偏移)),]) Sourav Anilkumar //www.tianjin-qmedu.com/matlabcentral/profile/authors/17677533