Plotting cos functions in matlab

19 Ansichten (letzte 30 Tage)
mandy
mandy am 22 Mär. 2015
Bearbeitet: Walter Roberson am 4 Feb. 2025
Can someone tell me how you would plot a cos function into matlab so that you can see a few periods of the graph? I am trying to graph
v(t)= 5.6576cos(377t+44.9945)
where the 44.9945 is the angle for the phase. I am also trying to get
v1(t)= 10cos(377t)
for a few periods

Akzeptierte Antwort

the cyclist
the cyclist am 23 Mär. 2015
Bearbeitet: the cyclist am 4 Feb. 2025
omega = 377;
t = (0:0.01:(6*pi))/omega;
v = 5.6576*cos(omega*t+44.9945);
v1 = 10*cos(omega*t);
figure
h = plot(t,v,t,v1);
legend(h,{'v','v1'})

Weitere Antworten (1)

mohammed
mohammed am 20 Jan. 2025
Bearbeitet: Walter Roberson am 4 Feb. 2025
t = 0:0.01:(2*pi);
x = cos(t);
y = sin(t);
plot(t,x,'k'); hold on;
plot(t,y,'r-.');
axis([0 2*pi -1.5 1.5])
legend('cos(t)','sin(t)','Location','NorthEast')

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by