//www.tatmou.com/matlabcentral/answers/questions?term=tag%3A%22function%22 MATLAB的答案——新问题匹配标签:“功能” 2023 - 05 - 28 - t18:17:07z 标签:www.tatmou.com, 2005:问题/ 1974684 2023 - 05 - 28 - t08:49:05z 2023 - 05 - 28 - t18:17:07z 如何编写子函数在一个GUI功能? 我想写一个子功能或下标在GUI,但不是一个回调函数,我想这个函数内使用任何类型的全局变量或下标,或创建新的全局变量。是可能的吗? Merse加斯帕 //www.tatmou.com/matlabcentral/profile/authors/15614680 标签:www.tatmou.com, 2005:问题/ 1974694 2023 - 05 - 28 - t09:12:01z 2023 - 05 - 28 - t18:06:47z 是否有可能通过一个变量throu一个回调函数? 我的问题是,我有许多类似的按钮,生成在一个循环,我不想写相同数量的回调函数。它就足够了,如果一个参数可以传递给显示哪个按钮,即哪个按钮调用函数。例子:我= 1:10 0色(i) = uicontrol(“风格”,“按钮”,“弦”,sprintf (Nr。% d '我),“位置”,(30 * 10,20,20],”写成BackgroundColor’, (。5。5。5),“回调”,{@button_Callback});结束 Merse加斯帕 //www.tatmou.com/matlabcentral/profile/authors/15614680 标签:www.tatmou.com, 2005:问题/ 1974704 2023 - 05 - 28 - t09:39:28z 2023 - 05 - 28 - t17:51:55z 如何使用子程序在subroutins GUI功能? 如果我在一个GUI功能函数,它可以访问GUI的全局变量,所以我可以使用它像一个子程序。但是我怎么能使用相同的函数在另一个函数?因为如果我将它嵌入到另一个函数,它已经“无法识别的函数或变量”说。快捷键我想使用子程序即使在子例程。我怎么能这样做呢? Merse加斯帕 //www.tatmou.com/matlabcentral/profile/authors/15614680 标签:www.tatmou.com, 2005:问题/ 15747 2011 - 09 - 13 - t11:53:52z 2023 - 05 - 28 - t07:56:08z 如何绘制函数θ和φ。例如{cos(φ)。^ 3 *罪(θ)+(φ)}的罪在球坐标。 如何绘制函数θ和φ。例如{cos(φ)。^ 3 *罪(θ)+(φ)}的罪在球坐标。 yashaswi //www.tatmou.com/matlabcentral/profile/authors/3043147 标签:www.tatmou.com, 2005:问题/ 1969419 2023 - 05 - 21 - t12:41:40z 2023 - 05 - 27 - t17:22:40z 浏览一个函数具有不同的值 我想浏览一个函数f 2值:1如果(x, y)和2如果b (x, y)我怎么能这样做呢?我还附上一幅画为x, y。 亚历山德拉罗克珊娜 //www.tatmou.com/matlabcentral/profile/authors/23137004 标签:www.tatmou.com, 2005:问题/ 1974074 2023 - 05 - 26 - t12:37:22z 2023 - 05 - 26 - t14:07:54z 写一个函数 我拯救了卷积函数的输出变量y(即y = conv (x, h);)。我想打印函数y的功能而不是一个数组中的值图。matlab函数是什么,我应该使用? 塔拉 //www.tatmou.com/matlabcentral/profile/authors/28730126 标签:www.tatmou.com, 2005:问题/ 1973664 2023 - 05 - 25 - t16:16:22z 2023 - 05 - 25 - t16:16:22z 使用函数处理私有财产和私有方法 你好,每个人。我已经尝试使用函数句柄类的私有方法和/或私人性质。下面我提供了一个简单的示例类。我目前使用Matlab R2023a,但我也使用Matlab R2019b得到相同的结果。classdef测试% <处理属性(访问=私人)这testVar端属性(访问=私人)fn端方法(访问=公共)功能obj =测试(accessSwitch) obj。这= '这';obj。= ',';obj。testVar = 2;如果(accessSwitch) obj。fn = @obj.takeThat; obj.testVar = 1; obj.that = '123'; elseif (~accessSwitch) obj.fn = @obj.considerThis; obj.testVar = 2; obj.this = '456'; else error('not hitting the above cases'); end end function processTest(testObj) testObj.fn(); end end methods (Access = private) function takeThat( obj ) fprintf( '%s\n', obj.that ); end function considerThis( obj ) fprintf( '%s\n', obj.this ); end end end I tested this class with the accessSwitch set both to 0 and 1. I set a breakpoint in the debugger at the point where the "takeThat" or "considerThis" function is called. In both cases, the private properties are not updated. "testVar" remains as 2, even if the accessSwitch is 1. Additionally, the "that" and "this" properties are not modified to "123" or "456" either. It appears that when the function handle is defined, it saves the current values of the properties and does not account for further modifications of the properties. Correct me if I am mistaken, but creating a function handle shouldn't restrict any further modifications to the values of the private properties, correct? I continued to experiment and noticed that creating the function handle after changing the property values instead results in "testVar" and "that" using "1" and "123" respectively when calling the "processTest" function (see code block below). This is the result I would have expected from the original implementation above. if ( accessSwitch ) obj.testVar = 1; obj.that = '123'; obj.fn = @obj.takeThat; Is this importance of where you create your function handle intentional? If so, why? Lastly, I am aware that uncommenting the section in the classdef line (i.e., making it a handle class) effectively prevents the problem. However, I would prefer not to define a handle class, as the ability to assign a handle object to multiple variables can be dangerous. I would like to mitigate this risk. Thank you for your help. . 奥斯汀兰达 //www.tatmou.com/matlabcentral/profile/authors/22575824 标签:www.tatmou.com, 2005:问题/ 1972314 2023 - 05 - 24 - t12:02:47z 2023 - 05 - 25 - t14:58:34z 找不到函数@ (fd) (1 / (1 + (fd / fdmax2) ^ 2))在E: \ matlab \ bin \ hw3.m。 为什么会有错误:找不到函数@ (fd) (1 / (1 + (fd / fdmax2) ^ 2))在E: \ matlab \ bin \ hw3.m。? ? ?% v模型B = 1200;c = 3 e8;f2 = 2.4 e9;f5 = 5.25 e9;% 2,4 GHz fmax2 = v * f2 / c;fdmax2 = fmax2/5; %多普勒扩散Tc2 = 1 / fdmax2; % Coherrence时间2 GHz = 9;%为5.25 GHz fmax5 = v * f5 / c;fdmax5 = fmax5/5; %多普勒扩散Tc5 = 1 / fdmax5; % 5.25 GHz Coherrence时间%情节多普勒sprectrum模型B、2 GHz fd = (-fmax2)。*兰德(1000 1)+ fmax2; plot(Phih_B_2(fd),fd) function Phih_B_2=g2(fd) Phih_B_2=(1/(1+A(fd/fdmax2)^2)); end Ruslan Askarov //www.tatmou.com/matlabcentral/profile/authors/28647216 标签:www.tatmou.com, 2005:问题/ 1670774 2022 - 03 - 13 - t21:07:19z 2023 - 05 - 25 - t07:18:13z MATLAB基础课程问题创建一个本地函数 嗨,我试图完成MATLAB基础课程,我遇到了一个probel 15章1。最后一部分“创建和调用本地函数”。我跟着isntructions和我的答案就像提供的解决方案,我甚至试着复制粘贴解决cell-wise但答案不能通过最后的测试,即。”页的计算函数paretoperc ?”. Someone please help me with it. I skipped it for now and completed the rest of the course and now my progress is stuck at 99%. 特辛格 //www.tatmou.com/matlabcentral/profile/authors/19224789 标签:www.tatmou.com, 2005:问题/ 678518 2020 - 12 - 04 - t16:09:36z 2023 - 05 - 24 - t17:01:02z 为什么我的方法不承认我定义为全球的变量U ? 我写一个方法在设计器中应用,这样我可以叫我需要的功能,不写他们每次为每个按钮。但是我得到一个小错误而执行第三个函数(= 1:中元素个数(U)):方法(访问=公共)函数实现= loadingdata (app) %的第一个函数加载数据加载数据。垫Table1加载数据。垫表. .结束函数输入= timeandfrequency (app) % 2函数输入windows回答= questdlg(有时间戳吗?,…“请给时间戳”,……“是的”,“不”,“不”);如果(回答= =“是”)提示={”类型的开始时间(HH: MM: SS)”,“类型endtime (HH: MM: SS)的};dlgtitle = '时间在HH: MM: SS”;dim = 40 [1];definput = {‘13:20:00’,‘13:50:00};time_answer = inputdlg(提示,dlgtitle,弄暗,definput); st = time_answer{1,:}; et = time_answer{2,:}; end answer = questdlg(' Which Frequency would you like to plot ?', ... '', ... 'Frequency 1','Frequency 2','Frequency 3','Frequency 3'); end function plotting = diagrams(app) % third function for plotting the data for k = 1:numel(U) Var = Variableunits.Variable; Num = size(Var,1); X = T.Variable==U(k); Uhrzeit = round(seconds(T.Time(X)/1000)); %Umwandlung der Uhrzeit zum Format HH:MM:SS Uhrzeit.Format='hh:mm:ss'; Uhrzeit = sort( Uhrzeit,'ascend'); Wert = T.Value(X); if (answer == "yes") % Wenn ein Zeitstempel vorhanden ist ind = find(Uhrzeit >= st & Uhrzeit <= et);%Die Uhrzeit zwischen Anfangsuhrzeit und Endzeit einschränken Uhrzeit = Uhrzeit(ind); Wert = Wert(ind); end switch answer case 'Frequency 1' .... case 'Frequency 2' .... case 'Frequency 3' .... end %switch end %for end %function end %method After executing the first button as an example, it calls the 3 function and then I get the error: Unrecognised function or variable U in the method, despite defining it as a global variable below: % Button pushed function: Variable1Button function H2_TEMPERATURE_Pt01CelsiusButtonPushed(app, event) loadingdata(app) % first function timeandfrequency(app)% second function global Us global U; Us = ["Variable1"]; U = categorical(Us); %for loop diagrams(app) % third function Why does the function cant recognise the variable U? How can the method recognises it from the button function? 雷默Rafsel //www.tatmou.com/matlabcentral/profile/authors/12574602 标签:www.tatmou.com, 2005:问题/ 1971519 2023 - 05 - 23 - t18:26:45z 2023 - 05 - 24 - t15:28:14z xcorr延迟输入时间吗? 你好,我想找两个1 x180000向量的互相关(sigX和sigY)。采样频率是fs = 1000。我试图找到xcorr与30年代的滞后。我怎么输入滞后30:30 sec xcorr函数给定的采样率?[c,滞后]= xcorr (x, y,滞后,“归一化”);输入的询问是滞后的。这是输入样本或时间吗?如果时间,单位时间什么?谢谢你! 卡莉 //www.tatmou.com/matlabcentral/profile/authors/12232346 标签:www.tatmou.com, 2005:问题/ 367192 2017 - 11 - 15 - t12:03:45z 2023 - 05 - 24 - t09:29:39z 使用矩阵函数 你好,我想做一个函数,它将生成一个交流感应电动机的转矩速度曲线。问题似乎是参与使用矩阵作为输入变量。Se函数:函数[torque1, torque2 torque3,扭矩]= computeTorque (x, y) torque1 = 11860 * 1.37 + (x / x) 1;torque2 = 11860 * 1.37 * 94.248. / x;torque3 = 11860 * 94.248 * 188.5. / x ^ 2;如果x < y扭矩= torque1;其他转矩= torque2;结束结束速度范围的汽车将从1 - - > 241 rad / s,这也是将输入“x”在我的函数。当我运行功能我用矩阵“Omag”从工作区中这是一个2401年,1行矩阵(1 - 241的步骤0.1)。“y”变量是电动机的磁场减弱频率设置为94.2。 When running function i use y matrix from workspace, which is just a row vector with same size as "Omag" and contains the field weakening frequency. This value is used to compare "Omag" matrix to make sure that below this frequency the torque is equal to maximum torque(Tnom*overload factor). Command window to run function and plot: >> [torque1,torque2,torque3,torque]=computeTorque(Omag,y); >> plot(Omag,torque) The thing is, that if I put in a scalar speed value for "x" variable, the function gives out a correct single torque value based on speed [rad/s]. The problem is using the Omag row matrix as "x" variable See attached files, together with a screen shoot on how the plot should look like Please adwise Marius //www.tatmou.com/matlabcentral/profile/authors/11442319 标签:www.tatmou.com, 2005:问题/ 1971569 2023 - 05 - 23 - t20:30:15z 2023 - 05 - 24 - t05:47:29z 我怎么连接多行成一条线在图吗? 我这样的连接这些线 高山bora ozun //www.tatmou.com/matlabcentral/profile/authors/20447991 标签:www.tatmou.com, 2005:问题/ 316429 2016 - 12 - 11 - t17:04:24z 2023 - 05 - 23 - t11:58:28z 我怎么能使用根函数来显示所有的根一个复数躺在一个圆。 问题给出以下信息:鉴于z = 1 + 3,什么是z ^ 1/4, arg (z)的范围:π/ 2 < arg (z) <π我看我如何使用根函数来解决这个问题,我如何找到另一根生成一个图,显示所有的根在复平面躺在一个圆圈。到目前为止我的代码不使用根功能:z = 1 + 3;我=图像放大(z);Re =实际(z);杂志= abs (z);θ=每股(Im / Re);%更多数据的权力n = 1/4;k = 1:4;arg =(θ* n + (2 * k *π)* n) x = cosd (arg);y = 1 *信德(arg); r = Mag.^(n); zn = r.*(x) + r.*(y); zn = zn' Any advice would be greatly appreciated. 托德•特 //www.tatmou.com/matlabcentral/profile/authors/9071159 标签:www.tatmou.com, 2005:问题/ 786466 2021 - 03 - 29 - t07:40:42z 2023 - 05 - 23 - t04:02:59z 函数定义不支持集群,但在交互模式下可用金宝app 当我试着运行以下程序%测试程序I = 1:3600 waitawhile (1) disp(我)结束函数waitawhile(时间)%等待时间秒暂停(时间)结束在Matlab(2020)在一个集群交互模式(也无显示选项)和Matlab在线效果完美,但当我提交的工作在一个集群(srun Matlab -nodisplay test.m)我得到以下错误函数waitawhile(时间)错误:函数定义不支持在这个上下文。金宝app创建函数的代码文件。结束错误:Illigal使用保留字‘结束’我不确定为什么这发生错误,应该有一个问题与当地Matlab函数在一个脚本。有具体原因代码不工作在同一集群交互模式而不是当提交一份工作? 桑德沃斯 //www.tatmou.com/matlabcentral/profile/authors/6826596 标签:www.tatmou.com, 2005:问题/ 1970559 2023 - 05 - 23 - t02:10:53z 2023 - 05 - 23 - t03:42:07z 正或南虽然试图运行一个函数 嗨,我是非常新的MATLAB和我有一些麻烦。我试图整合一个方程求解比热容。有人能解释这个错误是什么以及如何修复它吗?谢谢。T_datum_K = 25 + 273.15;T_in_K = 199.3 + 273.15;T_out_K = 359 + 273.15;% Ar C1_Ar = 20786;C2_Ar = 0;C3_Ar = 0; C4_Ar = 0; C5_Ar = 0; func = @(T) C1_Ar + C2_Ar.*((C3_Ar./T)./(sinh(C3_Ar./T))).^2 + C4_Ar.*((C5_Ar./T)./(cosh(C5_Ar./T))).^2; Cp_Ar_in = integral(func, T_datum_K, T_in_K); Cp_Ar_out = integral(func, T_datum_K, T_out_K); SL //www.tatmou.com/matlabcentral/profile/authors/30090762 标签:www.tatmou.com, 2005:问题/ 1969589 2023 - 05 - 21 - t23:09:44z 2023 - 05 - 21 - t23:45:57z 我想实现这个功能,但是它说有一个语法错误. . 函数y = myfunc (x) y = (x < 0) * (2 * exp (x) + (0 < = x < 1) * 2 + (1 < = x < 3)。* * x (x ^ 2 - 4 + 5) + (3 < = x) * (1 + cos (x - 3));endfunction JongMyung //www.tatmou.com/matlabcentral/profile/authors/30200660 标签:www.tatmou.com, 2005:问题/ 1969494 2023 - 05 - 21 - t17:21:08z 2023 - 05 - 21 - t19:48:25z 通过ga工具箱来解决函数有两个变量 你好,我已经和两个变量和一个函数我想利用ga优化函数。很久以前我使用工具箱,我忘记如何使用它。任何一个能帮我请。我的函数y = x (1) + 0.61 * -4.27 * 0.25 (2) + 13.34 * x (1) * (2) -4.69 * x (2) ^ 2;和变量的范围是磅= [0.001,0.01];乌兰巴托= [0.045,0.1];;我想使用numberOfVariables = 2;[x, fval] = ga (FitnessFunction numberOfVariables,磅,乌兰巴托)谢谢 娜迪娅楠迪 //www.tatmou.com/matlabcentral/profile/authors/6674209 标签:www.tatmou.com, 2005:问题/ 59530 2013 - 01 - 22 - t13:09:26z 2023 - 05 - 21 - t12:21:00z 列出所有工具箱函数 我环顾四周,但只发现depfun()和()。但有一个命令列出所有工具箱中的函数(不包括附件)? 尤尔根• //www.tatmou.com/matlabcentral/profile/authors/3856921 标签:www.tatmou.com, 2005:问题/ 1967939 2023 - 05 - 19 - t12:46:08z 2023 - 05 - 19 - t15:21:48z 我就想知道的问题是我的“迭代”功能以及如何解决它 我的脚本是完全工作除了行假设迭代,matlab不承认迭代函数你可以帮我吗?% Atm条件R = 287.058;γ= 1.4;Cp = R *γ/ (gamma 1);T0 = 288.15;p0 = 101325;a0 = 340.29;%扩散器入口RR = .92;马赫=综合成绩;马= convmass(165年,“加快”,“公斤”); Ta = T0*(1 + Mach*Mach*(gamma - 1)/2); pa = p0*(1 + (gamma-1)*Mach*Mach/2)^(gamma/(gamma-1)); %% Compressor piC = 15; effSC = .88; % Inlet conditions T1 = Ta; p1 = pa*RR; % Find Cp & gamma with iteration Tfun = @(gamma,Cp) (T1 + T1*(1+(piC^((gamma-1)/gamma)-1)/effSC))/2; [CpC,gammaC] = iterate(Cp,5,Tfun); % Outlet conditions T2 = 2*Tfun(gammaC,CpC) - T1; p2 = p1*piC Cedrick De块 //www.tatmou.com/matlabcentral/profile/authors/19994069 标签:www.tatmou.com, 2005:问题/ 1967119 2023 - 05 - 18 - t17:01:54z 2023 - 05 - 19 - t14:40:59z 问题2块,一个在不显示,第二个是出现空的。 你好,我有2个小码,2块,第一个展示情节是空的,第二个是不显示,请谁能帮助我,谢谢,第一个代码:Ppvmax = 800;%瓦特/ m ^ 2 Tdl = 12;%的白天时间Tsr = 7;%的日出时间Ttod白天的时候Ttod = [0:1:24];Ppv = Ppvmax * sin(π* (Ttod-Tsr) / Tdl);情节(Ttod Ppv)等;结束第二个代码:Pfdg = 50;Pfz = 22;PLi = 267;Psh = 313; Pac=403; Ptv=86; Pwm=1.2; Pmicro=0.33; Pnot= 13; Pwater=8.5; for t=[0:1:24] if 5 jana nassereddine //www.tatmou.com/matlabcentral/profile/authors/22314720 标签:www.tatmou.com, 2005:问题/ 1966474 2023 - 05 - 17 - t17:50:25z 2023 - 05 - 17 - t17:51:01z 如何导出MatLab (fsurf)到.stl文件吗?(surf2stl不工作) 我能使用surf2stl文件和功能将“冲浪”转化为.stl然而,对于“fsurf”(冲浪定义为函数),转换功能似乎并不工作。谁有经验关于如何解决这个问题吗?(典型的X, Y, Z冲浪,surf2stl工作好。然而,对于X, Y, Z定义为函数,因此fsurf surf2stl不再有效。fsurf仍然情节/创建正确的模型图,但.stl并非成功创建:“写0方面”。谢谢你的帮助。)下面是我的代码:f_x = @ (u, v) 1.4 * cos (u);f_y = @ (u, v) 1.04 * sin (u);f_z = @ (u, v) 2.4 * sin (v)。* sin (u);umin = 0; umax = pi; vmin = -pi; vmax = 0; figure(1); clf; fsurf(f_x,f_y,f_z, [umin umax vmin vmax]) colormap jet xlabel('x-axis') ylabel('y-axis') zlabel('z-axis') xlim([-4 4]) ylim([-4 4]) zlim([-4 4]) surf2stl('EXPORT_ATTEMPT.stl', f_x,f_y,f_z) 查尔斯 //www.tatmou.com/matlabcentral/profile/authors/30098578 标签:www.tatmou.com, 2005:问题/ 473277 2019 - 07 - 22 - t04:00:00z 2023 - 05 - 17 - t07:56:38z 我怎么从基础工作空间访问变量在MATLAB功能块? 我怎么从基础工作空间访问变量在MATLAB功能块? MathWorks支金宝app持团队 //www.tatmou.com/matlabcentral/profile/authors/4622813 标签:www.tatmou.com, 2005:问题/ 1923965 2023 - 03 - 06 - t15:59:42z 2023 - 05 - 17 - t04:12:57z 正弦曲线的离散数据集 这就跟你问声好!我有一些离散的气候资料,当我把它们像这样,谁能告诉我我怎样才能适应这些离散点到一个正弦曲线呢?数据是一个小23 x4000矩阵和我.mat文件添加到问题。任何反馈将非常有帮助。谢谢你! 阿什法克·艾哈迈德 //www.tatmou.com/matlabcentral/profile/authors/23505095 标签:www.tatmou.com, 2005:问题/ 1965099 2023 - 05 - 16 - t09:56:12z 2023 - 05 - 16 - t14:05:37z 计算相应的行之间的斯皮尔曼系数两个矩阵计算的有效方法 我有多个对大型矩阵(nx1000)存储在单元阵列。我设计了一种方法来提取的值,然后使用cellfun斯皮尔曼相关系数计算。然而,我最终nxn矩阵,它需要很多的时间来计算。我只希望nxn矩阵的对角线值,只有要计算两个矩阵的系数对应的行,而不是计算双行。我该如何去做呢?(“行”、“成对”)选项。柯尔()函数似乎并没有帮助。 Alekhya Hati //www.tatmou.com/matlabcentral/profile/authors/19225104 标签:www.tatmou.com, 2005:问题/ 1964879 2023 - 05 - 16 - t07:09:56z 2023 - 05 - 16 - t07:20:01z 十二进制转换器 我创建一个函数为十进制二进制转换器在xilinx Mcode块中使用这个函数。但它是显示错误。错误:错误(“dataconverter.m”): 2:9 dec2bin行之前没有分配值这一点。拼写错误或switch语句没有否则声明可能导致此错误。错误发生在“块配置”。编写和功能是:函数B = dataconverter B (A) = dec2bin (, 2);结束 放进耆那教徒的 //www.tatmou.com/matlabcentral/profile/authors/29171943 标签:www.tatmou.com, 2005:问题/ 1962884 2023 - 05 - 14 - t09:35:50z 2023 - 05 - 15 - t15:21:19z 多次运行一个函数和记录输出为每个运行在一个表中。 我有一组数据(125000行,38列),我想运行此代码为矩阵的每一列从第二列。然后,创建两个表的输出。科勒姆(一种常见的列),一个是时间用于计算。这是代码:% xlsx数据导入dat = importdata (“DataBook.xlsx”);t = dat.data (: 1);%时间= dat.data (:, 2);%原始信号(这只是一个专栏中,我需要相同的代码重复为其余列(2 - 38)%频率空间kHz = 1 e3;f_us = 27.441 *千赫;T_us = 1 / f_us;dt = t - t (1) (2); Fs=1/dt; %sampling frequency f=linspace(1,Fs,length(t)); %Fourier Transform SO=fft(so); figure(1); plot(f,abs(SO)); xlim([0 Fs/2]); xlabel('Frequency [Hz]'); %theoretical undersampling frequency ncycle=ceil(dt/T_us); %=9 tau=T_us*ncycle-dt; T_fake_theory=(T_us/tau)*dt; F_fake_theory=1/T_fake_theory; %684 Hz %practical undersampling frequency due to stage move SOa=abs(SO); F_fake=f(find(SOa(1:round(length(SOa)/2))==max(SOa))); %663.9 Hz T_fake=1/F_fake; %IQ-signal s_cos=so.*cos(2*pi*F_fake*t); s_sin=so.*sin(2*pi*F_fake*t); %move-mean N_mean_cycle=100; mean_point=round((N_mean_cycle*T_fake)/dt); mean_cos = 2*movmean(s_cos,[mean_point mean_point]); mean_sin = 2*movmean(s_sin,[mean_point mean_point]); mean_abs=sqrt(mean_cos.^2+mean_sin.^2); %result of A(t) (I need these values in a table for all columns; a matrix of 125000 rows and 37 columns) mean_phase=atan2(mean_sin,mean_cos); %result of theta(t) (I need these values in a table for all columns; a matrix of 125000 rows and 37 columns) Zahra //www.tatmou.com/matlabcentral/profile/authors/28507584 标签:www.tatmou.com, 2005:问题/ 1958434 2023 - 05 - 05 - t05:23:41z 2023 - 05 - 15 - t08:11:53z 错误equallystrong(第8行)结果= equallystrong (yourLeft, yourRight, friendsLeft friendsRight); 我的代码有问题请帮助尽快继承者testRun =输入的代码(“输入测试运行数:”);yourLeft =输入(输入你的左臂的起重能力:”);yourRight =输入(输入你的右臂的起重能力:“);friendsLeft =输入(输入你朋友的左臂的起重能力:”);friendsRight =输入(输入你朋友的右臂的起重能力:”);%检查是否同样强烈的结果= equallystrong (yourLeft、yourRight friendsLeft, friendsRight);%显示结果,如果结果disp(“测试运行”+ testRun +”:真正的“);其他disp(“测试运行”+ testRun +”: False”);结束 rheymar贝尔纳多 //www.tatmou.com/matlabcentral/profile/authors/21461118 标签:www.tatmou.com, 2005:问题/ 1951293 2023 - 04 - 22 - t04:22:56z 2023 - 05 - 14 - t20:12:13z n_subject识别函数或变量 为什么我得到这个消息,如何修复它吗?谢谢你的答案! Suphakson //www.tatmou.com/matlabcentral/profile/authors/29851165 标签:www.tatmou.com, 2005:问题/ 1962284 2023 - 05 - 12 - t15:55:22z 2023 - 05 - 13 - t07:19:42z 我怎样才能拯救我的函数变量之一吗? 你好,我想保存一个时间变量(“NOD1”)的函数。米,但我不能算出来。你能帮我吗?我这里有附加的功能。m和主要。米我想保存所有“NOD1”的结果。这有可能吗?谢谢你的帮助。亲切的问候, ADNAN //www.tatmou.com/matlabcentral/profile/authors/30127893 标签:www.tatmou.com, 2005:问题/ 1962269 2023 - 05 - 12 - t15:34:01z 2023 - 05 - 12 - t16:37:33z 未定义的函数“uifigure”“char类型的输入参数。 我试图使程序通过调用一个函数使用matlab gui功能aes % Membuat gui图= uifigure(“名字”,“aes”);按钮= uibutton(图,“位置”,[20 100 30],‘文本’,‘PilihGambar’,‘ButtonPushedFcn’, @ (btn、事件)selectImage (btn));editField = uieditfield(图中,“位置”,[140 200 30],“可编辑”,“关闭”);button2 = uibutton(图中,“位置”,[360 100 30],‘文本’,‘Enkripsi’,‘ButtonPushedFcn’, @ (btn、事件)encryptImage (editField.Value btn));button3 = uibutton(图中,“位置”,[480 100 30],‘文本’,‘Dekripsi’,‘ButtonPushedFcn’, @ (btn、事件)decryptImage (editField.Value btn));结束,但总是无法运行程序也可以运行(通过武力)只生成一个图图像没有内容(空白) 默罕默德Syahrul //www.tatmou.com/matlabcentral/profile/authors/27186680 标签:www.tatmou.com, 2005:问题/ 1957609 2023 - 05 - 03 - t23:10:52z 2023 - 05 - 12 - t12:05:12z 我怎么能让这一个可调用的函数? 函数[我]= firststateupdate (N P_ub w1) i = 1: N w1 =兰迪([0,1],1);如果是(我)= = 2 & & w1 < P_ub (i) = 1;端端端没有足够的输入参数。错误firststateupdate(第2行)i = 1: N 贝利麦克马斯特 //www.tatmou.com/matlabcentral/profile/authors/20996904 标签:www.tatmou.com, 2005:问题/ 677868 2020 - 12 - 04 - t08:14:32z 2023 - 05 - 11 - t12:14:49z 警告:达到的最大数量评估函数(10000)。通过全球错误测试结果。 θ= xlsread (' KomoriPro1.xlsx ' 1 '答:');φ= xlsread (' KomoriPro1.xlsx ' 1 ' D: D ');theta_ = xlsread (' KomoriPro1.xlsx ' 1 ' G: G ');phi_ = xlsread (' KomoriPro1.xlsx ' 1 ' K: K ');θ=θ*π/ 180;theta_ = theta_ *π/ 180;φ=φ*π/ 180;phi_ = phi_ *π/ 180;= 0(19 ^ 4,1);%矩阵气(130321 x1) J = 0 (19 ^ 4, 1);我= 0 (19 ^ 4,1); count = 1; for i= 1:length(theta) for j= 1: length(phi) for k= 1: length(theta_) for m=1:length(phi_) chi= acos(sin(theta(i))*sin(theta_(k))*cos(phi(j))*cos(phi_(m))+sin(theta(i))*sin(theta_(k))*sin(phi(j))*sin(phi_(m))+ cos(theta(i))*cos(theta_(k))); a(count) = chi; if theta(i) == (1.571) O = integral2(@(theta,phi) asin(theta)*dirac(pi/2) , 0,3.14,0,3.14); J(count) = integral2(@(theta_,phi_) O*sin(chi)*sin(theta_),0,3.14,0,3.14); I(count) = integral2(@(theta,phi) J(count)*O*sin(theta),0,3.14,0,3.14); else O = integral2(@(theta,phi) asin(theta) , 0,3.14,0,3.14); J(count) = integral2(@(theta_,phi_) O*sin(chi)*sin(theta_),0,3.14,0,3.14); I(count) = integral2(@(theta,phi) J(count)*O*sin(theta),0,3.14,0,3.14); end count = count + 1; end end end end BALPARTAP辛格 //www.tatmou.com/matlabcentral/profile/authors/19613647 标签:www.tatmou.com, 2005:问题/ 1961424 2023 - 05 - 11 - t10:16:57z 2023 - 05 - 11 - t10:21:28z 分配给变量值可能不确定(Ln 12) m = 45;%在公斤k = 35000;%弹簧常数N / m c = 1200;%的阻尼系数N * s / m F0 = 600;% Nω= 40力的振幅;在rad / s %角频率的力量x0 = 0.0001;%初始位移在m = 0.1;%初始速度在m / s t = linspace (0, 1000);%时间范围从0到10秒1000数据点%计算响应函数使用运动方程:omega_n = sqrt (k / m);%固有频率ζ= c / (2 *√(m * k)); % damping ratio omega_d = omega_n * sqrt(1 - zeta^2); % damped natural frequency % Calculate the response function using the equation of motion: omega_n = sqrt(k / m); % natural frequency zeta = c / (2 * sqrt(m * k)); % damping ratio omega_d = omega_n * sqrt(1 - zeta^2); % damped natural frequency figure; plot(t, X); xlabel('Time (s)'); ylabel('Displacement (m)'); title('Response of Mass-Spring-Damper System'); grid on; firas //www.tatmou.com/matlabcentral/profile/authors/30020295 标签:www.tatmou.com, 2005:问题/ 1961359 2023 - 05 - 11 - t08:41:10z 2023 - 05 - 11 - t08:55:11z 如何使用变量函数在其他函数中创建GUI按钮?(如何调用处理结构?) 全球lstBox;inputfolder = uicontrol(“风格”、“按钮”,“弦”、“inputfolder”、“位置”,[4 2 15 4.5],@inputfoler_callback);lstBox = uicontrol(“风格”,“列表框”,“单位”,“归一化”,“位置”,[0.06 - 0.03 0.9 - 0.95],@lstBox_callback);函数inputfolder_callback (hObject、eventdata处理)folderPath = uigetdir (”、“inputpath”);imgFiles = dir (fullfile (folderPath * * \ * . png));testRemove =包含({imgFiles.name},“测试”);imgFiles (testRemove) = [];imgNames = {imgFiles.name};句柄。imgFiles = imgFiles; set(lstBox, 'String', []); set(lstBox, 'String', imgNames); set(lstBox, 'Value', 1); guidata(hObject, handles); end function lstBox_callback(hObject,eventdata,handles) files = handles.imgFiles; path = files(1).folder + "\" + files(1).name; end This code attempts to load a png image file into the path selected with the Inputfolder button and write a code indicating the png file name in the lstBox. Save the structure of the .png file in the 'imgFiles' variable "testRemove" removes the value with the name "test" and saves only the file name in "imgNames". And store the imgFiles in the 'handles' structure. From the listBox_callback function, you are trying to open an image by retrieving the hands.imgFiles in the hands The error message files = hands.imgFiles; Insufficient input arguments in this code. So what I'm curious about in this code is 1. How to use variables saved in handles in other functions? - Insufficient input arguments error 2. I'm trying to output a png file name to lstBox, how to call lstBox within a function without specifying the lstBox variable as global? niniki //www.tatmou.com/matlabcentral/profile/authors/25608833 标签:www.tatmou.com, 2005:问题/ 1958319 2023 - 05 - 04 - t20:37:27z 2023 - 05 - 10 - t11:15:35z 数值求解多个系统自由振动的程度 你好,我是试图解决自由振动四度系统采用数值和函数。但是我不明白为什么但系统的响应是一个streight线。我的系统有四个质量和四个弹簧系数,与初始行使dispalcemnt m1 = 0.01, m2 = 0.01立方米= 0.02,m4 = 0.01和初速度0 0 0 0为每个质量。我pasisng代码。我会回复的反馈!函数函数xdot = f_4degree全球M K (t) x) =[0(4, 4)眼睛(4,4);K - M \ 0 (4, 4)] * x;xdot x = a *;数值全球M K m1 = 10;m2 = 10;m3 = 10; m4=10; k1=50; k2=50; k3=50; k4=50; M=[m1 0 0 0;0 m2 0 0;0 0 m3 0;0 0 0 m4]; K=[k1+k2 -k2 0 0;-k2 k2+k3 -k3 0;0 -k3 k3+k4 -k4;0 0 -k4 k4]; %ODE45 tspan=[0 20]; IC=[0.01 0.01 0.02 0.01 0 0 0 0]; [t,x]= ode45('f_4degree',tspan,IC); figure(1) plot(t,x(:,1)); legend('Repsonse') ylabel('x(t)') xlabel('time') 卡罗丽娜Kugiel //www.tatmou.com/matlabcentral/profile/authors/22017986 标签:www.tatmou.com, 2005:问题/ 1960769 2023 - 05 - 10 - t08:57:30z 2023 - 05 - 10 - t09:07:22z 我想要一个程序用户输入函数和函数的程序显示或情节 val =输入(“输入函数”,“s”);func = str2func ([' @ (x)“val]);x = (1:5);y = func (x);disp (y)这是一个代码示例代码我写,但不支持x ^ 2和其他大量的x ^“任意数量”金宝app 阿米尔 //www.tatmou.com/matlabcentral/profile/authors/30104515 标签:www.tatmou.com, 2005:问题/ 1960364 2023 - 05 - 09 - t15:14:57z 2023 - 05 - 10 - t03:29:01z 我得到错误当我试着阴谋乙状结肠函数 我试着阴谋与乙状结肠函数方程,但我得到错误M1 (1) = 0;t (1) = 0;h = 0.01;dt = -30: h: 30;t = 0(长度(dt), 1);M1 = 0(长度(dt), 1);i = 1:长度(t) t (i + 1) = (1) + dt;M1 (i + 1) = M1(我)+ 1. / (1 + exp (dt));最后情节(t, M1); cindyawati cindyawati //www.tatmou.com/matlabcentral/profile/authors/29229918 标签:www.tatmou.com, 2005:问题/ 3338 2011 - 03 - 16 - t18:09:49z 2023 - 05 - 10 - t00:06:05z 拉格朗日插值,打烊 谁能解释我如何使用该程序//www.tatmou.com/matlabcentral/fileexchange/899-lagrange-polynomial-interpolation函数y =拉格朗日(x, pointx尖)% %拉格朗日大约使用拉格朗日多项式插值点函数% %拉格朗日函数(x, pointx尖)大约看的点:% P1 = (pointx(1),尖(1)),P2 = (pointx(2),尖(2)),…PN (POINTX (N),尖(N)) %和计算它的每个元素X % %如果POINTX和尖尖的有不同数量的元素函数将返回NaN值% %函数写道:Calzino % 7 - 10月- 2001年% N =大小(POINTX 2);L = 1 (n,大小(x, 2));如果(大小(pointx 2) ~ =大小(尖,2))流(1 ' \ nERROR !\ nPOINTX和尖尖的必须有相同数量的元素\ n”);y =南;其他我= 1:n j = 1: n如果(我~ = j) L L(我:)=(我:)。* (x-pointx (j)) / (pointx (i) -pointx (j));端端端y = 0;因为我= 1:n y = y +尖(我)* L(我:);结束结束 buxZED //www.tatmou.com/matlabcentral/profile/authors/2753411 标签:www.tatmou.com, 2005:问题/ 1957484 2023 - 05 - 03 - t17:26:09z 2023 - 05 - 09 - t16:33:49z 计算归一化反射信号? 你好,我是试图计算信号的归一化反射使用特定的公式,但不确定如何使用MATLAB实现它。我有一个信号(1 x N组正值)变化的位置在时间(采样频率为60 Hz)。从这我试图使用下列方程计算归一化反射:混蛋在哪里第三位置作为时间的函数的导数,行程时间是中风的总时间需要从strart到结束和中风的总距离长度是中风从开始到结束(在这种情况下,欧氏距离)我特别困惑如何实现方程的积分和混蛋组件。你知道如何在MATLAB中实现方程? 卡莉 //www.tatmou.com/matlabcentral/profile/authors/12232346 标签:www.tatmou.com, 2005:问题/ 730723 2020 - 09 - 09 - t04:00:00z 2023 - 05 - 09 - t07:46:52z 如何加快评估符号表达式为大量的数值评估? 通常的方法来评估(我得到一个数值)为特定值的输入变量(超过一个变量)是使用“潜艇”功能或创建一个符号函数“symfun”。需要很长时间,如果我试着重复这个过程在for循环50000次不同的变量值。例如,下面的代码在电脑上花了10分钟不错的处理器和ram的规范。>> syms x y z f = 2*y*z*sin(x) + 3*x*sin(z)*cos(y) - z^3; g(x,y,z) = gradient(f, [x, y, z]) tic for i=1:50000 % d = double(subs(g,[x,y,z],[1,2,3])); d = double(g(1,2,3)); end toc >> g(x, y, z) = 3*cos(y)*sin(z) + 2*y*z*cos(x) 2*z*sin(x) - 3*x*sin(y)*sin(z) 2*y*sin(x) - 3*z^2 + 3*x*cos(y)*cos(z) >> Elapsed time is 600.937920 seconds. Is there a simple and faster way to achieve this workflow ? MathWorks支金宝app持团队 //www.tatmou.com/matlabcentral/profile/authors/4622813 标签:www.tatmou.com, 2005:问题/ 1958404 2023 - 05 - 05 - t03:17:27z 2023 - 05 - 08 - t06:58:18z 错误与SimBiology SMBL文件运行 我想运行这个模型与SimBiology但是看到一条错误消息。BIOMD0000000268_url。xml用L2V4表示Reed2008_Glutathione_Metabolism Reed2008_Glutathione_Metabolism | BioModels (ebi.ac.uk)“分段”是一个函数在matlab但似乎SimBiology模型建造承认它作为一个变量……任何想法?- - - - - - - - - - - -规则Aminoacid_input =分段(早餐,(le(7日白天),(白天,10)),午餐,和(le(白天),(白天,15)),晚餐,和(le(18日白天),(白天,21)),禁食)错误信息:“身份不明的规则包括变量。”红higllight“分段”- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Youngjae你 //www.tatmou.com/matlabcentral/profile/authors/17274962 标签:www.tatmou.com, 2005:问题/ 1959454 2023 - 05 - 07 - t21:10:29z 2023 - 05 - 07 - t22:08:49z 如何将预构建或预制功能从MATLAB仿真软件没有改写成新的“MATLAB函数”块吗?金宝app 嘿伙计,说我有一个在MATLAB函数,我写了例如:“add_two_numbers。m”我,我想把它作为一个整体在仿真软件(在这情况下,简化示例(x, y)输入和输出)[z]在一金宝app个模型中,例如,“Model.slx”。我看到“MATLAB函数”存在于模型(见附件图片),但是,我不想要复制粘贴的每金宝app个新功能并将其保存为一个新功能块模型。//www.tatmou.com/help/simulink/slref/matlabfunction.h金宝apptml精心制作的,这些信息是不满意,因为他们写一个全新的功能块,而不是引用一些他们已经编辑和创建。这可能是一个明显的问题,我错过了文档,但是有什么办法可以直接调用仿真软件,我以前在MATLAB函数?金宝app我希望我可以从我的路径和拖拽功能出现在仿真软件。金宝app我希望能够编辑功能在MATLAB仿真软件的编辑器,然后使用它,在仿真软件自动升级这个函数/与MATLAB函数。金宝app让我知道!非常感谢,乔恩 乔纳森·凯瑟琳 //www.tatmou.com/matlabcentral/profile/authors/19506984 标签:www.tatmou.com, 2005:问题/ 6197 2011 - 04 - 25 - t19:02:38z 2023 - 05 - 07 - t08:44:29z imshow 你好,我有一系列的jpeg图像,我试图进入在matlab和视图(最终,我愿意试着瓦)。我用他imread函数加载。imshow功能不工作。我得到以下错误错误= = > basicImageDisplay hh = 9点图像(xdata ydata, cdata,……错误在246 hh = = = > imshow basicImageDisplay (fig_handle ax_handle,…我试着以下:-改变rgb灰度降低基质的dimesnions - m文件重命名减少文件的大小/图像我进口。我最终以600 x800像素图像。这还是太大吗?任何评论上面,我们将不胜感激。谢谢米 Mi Sl //www.tatmou.com/matlabcentral/profile/authors/2844671 标签:www.tatmou.com, 2005:问题/ 333782 2017 - 03 - 29 - t04:00:00z 2023 - 05 - 04 - t11:29:36z 我在嵌套调用模型函数子系统如金宝app何? 我在一个子系统仿真金宝app软件功能的MyFun名为S1 '这是' S2 '的一个子系统。我得到以下错误当我从顶层调用这个函数:函数的错误:一个定义“MyFun”由函数调用者调用块不能被发现。我怎么能调用的函数“MyFun”函数调用者? MathWorks支金宝app持团队 //www.tatmou.com/matlabcentral/profile/authors/4622813 标签:www.tatmou.com, 2005:问题/ 1727145 2022 - 05 - 25 - t17:48:06z 2023 - 05 - 04 - t09:20:33z 方位、仰角x y z旋转 你好,输入我的旋转方位和仰角。我想有x y和z的旋转从这旋转我的三维数据。例如:通用= multicuboid (0.3, 0.3, 0.3);%创建立方体30厘米×30厘米×30厘米cube_coordinates = gm.Vertices;%从多维数据集复制坐标az = 45;%方位角= 45°el = 0;%仰角= 0°% [x, y, z] = azel2xyz (az, el);% rotMat = rotx (x) * roty (y) * rotz (z);%创建旋转矩阵与方位角45°rotMat = rotx * roty (0) (0) * rotz (45);%创建旋转矩阵与方位角45°cube_coordinates_rot = rotMat * cube_coordinates '; % apply rotation matrix cube_coordinates_rot = cube_coordinates_rot'; figure subplot(1,2,1) scatter3(cube_coordinates(:,1),cube_coordinates(:,2),cube_coordinates(:,3)); title('unrotated'); subplot(1,2,2) scatter3(cube_coordinates_rot(:,1),cube_coordinates_rot(:,2),cube_coordinates_rot(:,3)); title('rotated'); I'm looking for a solution for the function [x,y,z] = azel2xyz(az,el); I tried sph2cart without any success. Thanks for your help. 亨宁威廉 //www.tatmou.com/matlabcentral/profile/authors/9220057 标签:www.tatmou.com, 2005:问题/ 1956874 2023 - 05 - 02 - t21:09:09z 2023 - 05 - 02 - t23:38:03z 我如何添加箭头移动每个整合素粒子在我的阴谋。 N = 10;%的整合蛋白L = 100;% D域100纳米的大小= . 01;%扩散系数dt = 1;%时间步F =兰迪([1,10],1);%的力量与一个随机数的1到10 P_a =兰迪([0,1],1);%绑定一个随机数的速度从0到1 P_ub = 1 / (1.5 * F);%释放速率基于我们之前的值达峰时间= 500;%最大时间% Intialize整合蛋白x =兰迪([0360],N, 1);为每个整合素y = % x坐标生成randomily兰迪([0,50],N, 1); % y-coordinates generated for each state=ones(N,1); % Each integrin is set to an inactive state at 0 % our figure figure; axis([0 L 0 L]); set(gca,'nextplot','replacechildren'); % position update for t = 0:dt:Tmax % colors for our integrin states colors = repmat([1 0 0], N,1); % red for inactive state colors(state == 2,:,:) = repmat([0 1 0],sum(state == 2),1); % plotting our integrins scatter(x,y,50,colors,'filled'); title(sprintf('Time=%.2f',t)); drawnow; for i=1:N w=randi([0,1],1); if state(i)==1 dx=randi([-360,360],1); dy=randi([-50,50],1); x(i)=x(i)+dx; y(i)=y(i)+dy; end end x=mod(x,L); y=mod(y,L); for i=1:N w_1=randi([0,1],1); if w_1 < P_a && state(i)==1 state(i)=2; end end for i=1:N w1=randi([0,1],1); if state(i)==2 && w1 贝利麦克马斯特 //www.tatmou.com/matlabcentral/profile/authors/20996904 标签:www.tatmou.com, 2005:问题/ 1956739 2023 - 05 - 02 - t16:41:38z 2023 - 05 - 02 - t19:15:55z 问题计算的函数 你好,我有两个变量维度195414 x 1, FeatureDrag TopDrag我得到不同的结果,当我计算百分比的意思是这两个变量之间的区别。任何人发现我似乎忽视一个问题吗?方法1:Drag_reduction_instant = (FeatureDrag-TopDrag)。/ TopDrag;根据DR1 =意味着(Drag_reduction_instant,“所有”)* 100;方法2:TD_Final =意味着(TopDrag,“所有”);%上拖,意味着整个数据集的FD_Final =意味着(FeatureDrag,“所有”);%功能拖,意味着整个数据集的DR2 = (FD_Final-TD_Final) / TD_Final * 100;%这两个应该是相同的 本•汉密尔顿 //www.tatmou.com/matlabcentral/profile/authors/5102132 标签:www.tatmou.com, 2005:问题/ 758644 2021 - 02 - 28 - t16:40:19z 2023 - 05 - 02 - t18:55:33z 你如何在matlab中创建一个复合函数? 如果我有两个函数,就像函数= func1 b (x)和函数= func2 (q, p)为例。有可能把它们创建一个复合函数像func1 (func2 (q)) = func1∘func2 (q),如果是这样你怎么做呢? Buttercup12 //www.tatmou.com/matlabcentral/profile/authors/20964958 标签:www.tatmou.com, 2005:问题/ 1955819 2023 - 05 - 01 - t11:16:50z 2023 - 05 - 01 - t19:27:58z 从数值不熟悉的错误信息:“识别”packageAsFuncHandle函数或变量。 我的一个学生是在试图运行时接收这个消息从她的计算机数值。另一台机器上运行相同的脚本不抛出一个错误。我有她的卸载和重新安装MATLAB但得到相同的结果。别人经历过吗?没见过其他地方论坛/社区。谢谢! 布罗迪 //www.tatmou.com/matlabcentral/profile/authors/27387488