|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
%function Mredsim=n_Mm(Jredsim)
%Set initial "gemesste Strom"
Im = [151.0348 139.0837 119.3383 105.8283 90.7595 85.5633 79.8475 78.2887 82.6188...
82.4456 82.4456 83.6581 85.9097 85.9097 115.1814 139.0837 143.4138 148.0903...
133.7143 117.4330 107.9068 106.0015 116.0474 43.3013 46.7654 344.3317 146.5315...
146.5315 80.5404 80.5404 80.7136 80.7136 137.3516 132.3287 90.4131 75.1710...
72.5729 75.8638 78.2887 78.2887 161.2539 164.3716 162.9860 138.5641 144.7994...
158.1362 166.6233 166.7965 213.7351 192.0844 140.6425 108.0800 90.2398 80.7136...
82.0992 91.4523 103.5766 105.6551 105.8283 104.4427 111.8905 51.9615 49.1902...
403.0482 400.4501 161.7735 161.7735 106.8675 188.9667 229.8431 231.4020 231.4020...
177.7084 156.9238 142.3746 25.9808 69.2820 402.5286 401.3162 333.9394 321.4686...
310.7299 258.5952 200.9179 200.9179 124.3612 109.8120 95.4360 91.4523 91.6255...
104.2695 122.9756 126.2665 150.8616 167.6625 169.5678 153.1133 139.6033 127.3057...
125.7469 112.0637 126.0933 183.5974 200.9179 213.0422 251.6670 216.3331 216.3331...
119.5115 112.0637 109.4656 110.3316 116.7402 115.8742 106.5211 103.9230 96.4752...
97.5145 99.0733 104.0963 106.1747 110.6780 103.9230 100.4589 90.7595 87.8150...
86.4293 86.0829 86.2561 86.4293 86.4293 86.2561 85.2169 79.8475 79.8475...
77.7691 78.9815 80.8868 82.6188 82.4456 81.5796 78.9815 78.8083 80.7136...
81.4064 81.2332 80.8868 80.7136 79.8475 80.1940 82.4456 82.7920 83.4848...
85.5633 87.6418 90.7595 93.3575 93.8772 93.5307 93.0111 92.4915 91.7987...
91.6255 89.5470 89.7202 89.8934 89.8934 89.7202 89.7202 89.7202 89.5470...
89.3738 88.8542 88.8542 89.0274 89.3738 92.6647 92.1451 91.4523 90.7595...
87.2954 87.1222 87.1222 87.2954 87.4686 87.6418 87.6418 87.9882 87.9882...
88.5078 88.8542 89.2006 89.0274 89.0274 99.2465 111.8905 112.5833 122.4560...
122.2828 111.8905 109.6388 95.4360 86.0829 84.1777 83.4848 84.0045 84.8705...
92.1451 91.2791 91.1059 91.9719 104.2695 130.9430 168.3553 170.4338 183.2510...
191.9112 260.0000 291.5042 291.5042 236.4249 198.4930 198.4930 122.4560 87.2954...
83.1384 81.9260 92.8379 107.3872 115.7010 111.7173 101.1518 89.5470 86.4293...
81.2332 80.8868 80.8868 81.5796 93.5307 95.4360 103.9230 106.0015 107.3872...
113.6225 116.0474 130.4234 165.4109 177.8816 194.1629 223.2613 223.7810 207.1533...
204.3820 170.2606 150.5152 138.9105 127.3057 114.3154 100.1125 97.3413 90.9327...
92.4915 104.4427 138.5641 152.5937 154.6721 159.3487 141.5086 123.6684 124.5345 ...
170.9534 188.7935 204.7284 213.3887 183.2510 148.2635 94.0504 79.6743 73.9586...
79.3279 93.1843 91.9719 91.4523 90.2398 81.7528 80.3672 65.8179 25.9808...
29.4449 273.1444 308.3050 283.5367 69.4552 74.8246 74.6514 79.5011 83.3116...
85.3901 81.9260 73.7854 72.2265 72.2265 73.4390 75.1710 77.5959 77.4227...
75.5174 74.1318 73.6122 73.2657 73.2657 73.9586 74.3050 74.8246 74.6514...
74.4782 73.9586 73.9586 73.9586 73.9586 73.9586 74.1318 74.1318 74.1318...
74.1318 74.1318 74.1318];
%Drehnzahl rechnen
S=sqrt(65.02759421^2-4*(-0.02463815532)*(-42058.38932-Im));
nm=(-65.02759421-S)./(2*(-0.02463815532));
%Differenzial Gleichung rechnen
Jred=195;
Jredsim=input('enter the number of Jredsim : ');
tm=1:326;
dt=1;
%Mit formel Mred und Mredsim ausrechne
Mm= polyval([4.906818140e-007, - 0.003522870493, 8.928126016, - 9.675323630e+003, 3.830301399e+006],nm);
Mred=Mm(1:326)-(abs(diff(nm))*2*pi*Jred/60);
%Mredsim ausrechnen
n_e=zeros(1,size(nm(1:326),2));
Mm_e=zeros(1,size(nm(1:326),2));
for i=1:size(nm(1:326),2)
if i==1
n0=nm(i);
Mm_e(i)=polyval([4.906818140e-07,-0.003522870493,8.928126016,-9.675323630e+003,3.830301399e+006],n0);
sn=(Mm_e(i)-Mred(i))*dt/(2*pi*Jredsim);
n_e(i)=n0+sn;
else
Mm_e(i)=polyval([4.906818140e-07,-0.003522870493,8.928126016,-9.675323630e+003,3.830301399e+006],n_e(i-1));
sn=(Mm_e(i)-Mred(i))*dt/(2*pi*Jredsim);
n_e(i)=nm(i)+sn;
end
end
%Plot Motormoment-Mm,drehnzahl-n,reduziere Motormoment-Mred und reduziere simulink Motormoment-Mred
[AX,H1,H2]=plotyy(tm,[Mm(1:326);Mred],tm,[nm(1:326);n_e]);
ylim(AX(1),[-1000 1550]);
ylim(AX(2),[1450 1510]);
%xlim(AX(1),[0 330]);
%xlim(AX(2),[0 330]);
set(AX,'XTick',[0:10:330]);
set(AX(1),'YTick',[-1000:85:1550]);
set(AX(2),'YTick',[1450:2:1510]);
set(get(AX(1),'ylabel'),'String','Mm (t)','color','b','FontSize',14);
set(get(AX(2),'ylabel'),'String','nm(t)','color','r','FontSize',14);
set(H1(1),'LineStyle','-','color','b');
set(H1(2),'LineStyle','-','color','k');
set(H2(1),'LineStyle','-','color','r');
set(H2(2),'LineStyle','-','color','g');
box off;
title('Momentreduziert und Drehzahl','FontSize',16);
xlabel('t ','FontSize',14);
legend(H1,{'Mm','Mred(t)'},2)
legend(H2,{'nm','nredsim(t)'},1)
grid on;
在这个程序中的for和if循环语句不起作用,这是为什么?无论Jredsim是什么值,所显示出来的图都是一样的
哪位大大 能帮忙,当Jredsim输入不同的值的时候所得到的n_e应该是不同于nm的,而且很明显,但这个程序显示的不是这样
[ 本帖最后由 tianyi11911 于 2009-3-11 15:37 编辑 ] |
|