Coding and ploting of a serie

1 Ansicht (letzte 30 Tage)
OLuxanna
OLuxanna am 29 Okt. 2022
Kommentiert: OLuxanna am 29 Okt. 2022
Hello Everbody;
I'm newby to Matlab and I'm trying to write a code of this serie and trying to get the same plot of it. However ;whatever I have tried to do I couldnt manage to obtain them. May someone please help me?
here Vm(t)=0.18 m/s and the parameters that I need to use are
Here what I've tried to do so far;
t= 0:0.001:1; %time
a=[0.05282 -0.00909 -0.02733 0.02509 -0.00268];
b=[-0.04866 -0.0104 0.002598 0.02111 -0.01372];
w=8.483; %angular frequency
n=length(a);
n=length(b);
vel=zeros(n, length(t));
for i = 1:n
vel(i,:) = (0.18*0.1308)/(0.1308+sum(a(i)*cos(8.483*t*(i))+b(i)*sin(8.483*t*(i))));
end
hold on;
box on;
plot(t,vel(1,:), 'b', 'Linewidth', 2)

Akzeptierte Antwort

David Hill
David Hill am 29 Okt. 2022
t= 0:0.001:1;
n=1:5;
a=[0.05282 -0.00909 -0.02733 0.02509 -0.00268];
b=[-0.04866 -0.0104 0.002598 0.02111 -0.01372];
w=8.483;
vm=.18;
a0=.1308;
vel=vm/a0*(a0+sum(a.*cos(w*n.*t')+b.*sin(w*n.*t'),2));
plot(t,vel,'b','LineWidth',2)
  3 Kommentare
David Hill
David Hill am 29 Okt. 2022
t= 0:0.001:1;
n=1:5;
a=[0.05282 -0.00909 -0.02733 0.02509 -0.00268];
b=[-0.04866 -0.0104 0.002598 0.02111 -0.01372];
w=8.483;
vm=.18;
a0=.1308;
s=a.*cos(w*n.*t')+b.*sin(w*n.*t')%look at this matrix
s = 1001×5
0.0528 -0.0091 -0.0273 0.0251 -0.0027 0.0524 -0.0093 -0.0273 0.0258 -0.0033 0.0520 -0.0094 -0.0272 0.0265 -0.0038 0.0516 -0.0096 -0.0271 0.0271 -0.0044 0.0511 -0.0098 -0.0269 0.0277 -0.0050 0.0507 -0.0099 -0.0268 0.0283 -0.0055 0.0503 -0.0101 -0.0266 0.0288 -0.0060 0.0498 -0.0103 -0.0264 0.0294 -0.0066 0.0494 -0.0104 -0.0262 0.0298 -0.0071 0.0490 -0.0106 -0.0260 0.0303 -0.0076
sum(s,2)%sums the matrix along the rows
ans = 1001×1
0.0388 0.0384 0.0380 0.0376 0.0372 0.0368 0.0364 0.0359 0.0355 0.0350
vm/a0*(a0+ans)%then just add and multiply by some constants
ans = 1001×1
0.2334 0.2329 0.2323 0.2318 0.2312 0.2306 0.2300 0.2294 0.2288 0.2282
%ready to plot
plot(t,ans)
OLuxanna
OLuxanna am 29 Okt. 2022
I got you now. Thank you very much Sir.!!!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by