Create an input array from -1*pi to 1*pi

4 visualizzazioni (ultimi 30 giorni)
Aaron Kerr
Aaron Kerr il 23 Mag 2022
Commentato: Torsten il 25 Mag 2022
% Create an input array from -1*pi to 1*pi
t=[3 4 5 6 7 8 9];
% Calculate |sin(t)|
x=abs(sin(t));
%plot result
plot(t,x);

Risposte (1)

Walter Roberson
Walter Roberson il 23 Mag 2022
% Create an input array from -1*pi to 1*pi
t=-pi:pi;
% Calculate |sin(t)|
x=abs(sin(t));
%plot result
plot(t,x);
  5 Commenti
Aaron Kerr
Aaron Kerr il 25 Mag 2022
Thanks, what about if it was t=[0 1 2 3 4 5 6]; what is the "t" refering to.
Torsten
Torsten il 25 Mag 2022
If you set
t=[0 1 2 3 4 5 6];
x=abs(sin(t));
plot(t,x)
MATLAB takes the point (0,abs(sin(0))), (1,abs(sin(1))),...,(6,abs(sin(6))) and connects them in this order by straight lines in the plot.
Same for any array t that you define in advance.

Accedi per commentare.

Categorie

Scopri di più su Linear Algebra in Help Center e File Exchange

Tag

Prodotti


Release

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by