ploting of a serie

1 回表示 (過去 30 日間)
OLuxanna
OLuxanna 2023 年 4 月 25 日
編集済み: Torsten 2023 年 4 月 25 日
Hello Everbody;
I'm super newby to Matlab and I'm trying to write a code of this serie and trying to get the same plot of it. The plot looks like this;
However ;whatever I have tried to do I couldnt manage to obtain them and got error. May someone please help me?
in this equation N measurements xn that are made at equally spaced time intervals Δt. The total time to make the measurement series is NΔt.
Here what I've tried to do so far;
t= 0:0.015:0.75;
n=1:27;
%here cn is b instead and sn is c
b=[0.16192008
0.057114748
0.007084244
-0.030579111
0.005991497
0.002634926
0.006648294
-0.004367555
-3.22343E-05
0.001185171
-0.000498601
0.001195507
0.000412267
0.000549711
-0.001205937
9.1459E-05
0.001650418
-0.000110668
-0.000224846
-0.00025524
0.000365266
6.69066E-05
-9.4856E-05
0.00045407
-0.00046311
-0.000105615
0.000267089
];
c=[-1.13E-16
-0.097555768
-0.034007266
0.030570653
-0.007729332
0.00212137
0.003318958
-0.000721558
-0.002148456
0.001584847
0.00253001
-0.000917528
-0.00112851
0.001670685
-0.000314723
-0.000149633
0.000243032
0.000794516
-0.000583722
-0.000742117
0.001086391
6.77907E-05
-0.000414749
-0.000172707
0.000239546
-1.86E-07
-0.000422611
];
vel=sum(b.*cos((2*pi*n.*t')/27*0.015)+c.*sin((2*pi*n.*t'/27*0.015)),2);
plot(t,vel,'b','LineWidth',2)

回答 (1 件)

Torsten
Torsten 2023 年 4 月 25 日
編集済み: Torsten 2023 年 4 月 25 日
N = 53;
tstart = 0.0;
tend = 0.75;
dt = 0.015;
t= tstart:dt:tend;
t = t.';
n = 0:floor(N/2);
c=[0.16192008
0.057114748
0.007084244
-0.030579111
0.005991497
0.002634926
0.006648294
-0.004367555
-3.22343E-05
0.001185171
-0.000498601
0.001195507
0.000412267
0.000549711
-0.001205937
9.1459E-05
0.001650418
-0.000110668
-0.000224846
-0.00025524
0.000365266
6.69066E-05
-9.4856E-05
0.00045407
-0.00046311
-0.000105615
0.000267089
];
c = c.';
s=[-1.13E-16
-0.097555768
-0.034007266
0.030570653
-0.007729332
0.00212137
0.003318958
-0.000721558
-0.002148456
0.001584847
0.00253001
-0.000917528
-0.00112851
0.001670685
-0.000314723
-0.000149633
0.000243032
0.000794516
-0.000583722
-0.000742117
0.001086391
6.77907E-05
-0.000414749
-0.000172707
0.000239546
-1.86E-07
-0.000422611
];
s = s.';
vel = sum(c.*cos(2*pi*n.*t/(N*dt)) + s.*sin(2*pi*n.*t/(N*dt)),2);
plot(t,vel,'b','LineWidth',2)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by