|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
吴老师,你好,又一次麻烦你,依然是之前的嵌套函数求解问题,代码如下:
-
-
- function [t,u] = chunshui2003
- %%%% 基本参数数值 %%%%%
- mr = 600*10^3;
- De = 0.5*10^6;
- Ke = 0.5*10^10;
- delta_0 = 18*10^-3;
- e_0 = 2*10^-3;
- omega = 13.1; %水轮发电机额定转速,单位rad/s
- %%%% 电磁刚度参数数值 %%%%%
- Rg = 6.24;
- L1 = 2.1;
- k_u = 1.102;
- mu_0 = 4*pi*10^(-7);
- f = 50;
- theta = 30.64/180*pi;
- phi = acos(0.875);
- p = 40;
- Fsm = 19210;
- Fjm = 24214;
- Lambda_0 = mu_0./(k_u*delta_0);
- sigma = k_u*delta_0;
- omega_f = 2*pi*f./p;
- function uu = diff_equ(t,u)
- %%%%% Fx,Fy 表达式 %%%%%%
- Fx = mr.*omega.^2.*e_0.*cos(omega.*t);
- Fy = mr.*omega.^2.*e_0.*sin(omega.*t);
- %%%% 电磁刚度表达式 %%%%%
- coeff_1 = Rg.*L1.*Lambda_0./(2*sigma.^2);
- coeff_2 = coeff_1.*sigma;
- B = @(alpha) Fsm.*cos(omega_f.*t-p.*alpha); %积分大括号内第一项
- C = @(alpha) Fjm.*cos(omega_f.*t-p.*alpha+theta+phi+pi/2); %积分大括号内第二项
- C11 = @(alpha) 1+cos(2.*alpha);
- C12 = @(alpha) sin(2.*alpha);
- C22 = @(alpha) 1-cos(2.*alpha);
- C_1 = @(alpha) cos(alpha);
- C_2 = @(alpha) sin(alpha); %不同电磁刚度项的积分内容
- %
- D11 = @(alpha) coeff_1.*C11(alpha).*(B(alpha)+C(alpha)).^2;
- D12 = @(alpha) coeff_1.*C12(alpha).*(B(alpha)+C(alpha)).^2;
- D22 = @(alpha) coeff_1.*C22(alpha).*(B(alpha)+C(alpha)).^2;
- D_1 = @(alpha) coeff_2.*C_1(alpha).*(B(alpha)+C(alpha)).^2;
- D_2 = @(alpha) coeff_2.*C_2(alpha).*(B(alpha)+C(alpha)).^2; %电磁刚度积分表达式
- %
- K11 = quadgk(D11,0,2*pi);
- K12 = quadgk(D12,0,2*pi);
- K21 = quadgk(D12,0,2*pi);
- K22 = quadgk(D22,0,2*pi);
- K_1 = quadgk(D_1,0,2*pi);
- K_2 = quadgk(D_2,0,2*pi); %电磁刚度求解
- uu = zeros(4,1);
- uu(1) = u(2);
- uu(2) = -De/(mr*omega)*u(2)-(K11+Ke)/(mr*omega^2)*u(1)-K12/(mr*omega^2)*u(3)+Fx/(mr*delta_0*omega^2)-K_1/(mr*delta_0*omega^2);
- uu(3) = u(4);
- uu(4) = -De/(mr*omega)*u(4)-K21/(mr*omega^2)*u(1)-(K22+Ke)/(mr*omega^2)*u(3)+Fy/(mr*delta_0*omega^2)-K_2/(mr*delta_0*omega^2);
- end
- y0 = [0.001 0.001 0.001 0.001];
- period = 2*pi/13.1;
- [t,u] = ode15s(@diff_equ,[0:period/100:5*period],y0);
- end
复制代码
之前我曾经问过,如何显示计算这个带有嵌套函数的运动微分方程结果。您说在chunshui2003这个函数名称前添加[t,u]即可,即:
-
- function [t,u] = chunshui2003
-
复制代码
当运行后在变量参数处并没有显示时间t和相关运动项u的名称,只有ans以及主窗口中的一系列数值,这些应该是时间t的数值,也就是时间子步。
请问一下老师,这里面是哪个环节出现了问题,应该如何操作才能够获得我所希望的[t,u]呢。
麻烦吴老师了! |
-
|