Azzera filtri
Azzera filtri

Plotting multiple lines on one graph

1 visualizzazione (ultimi 30 giorni)
Will Jeter
Will Jeter il 4 Mar 2021
Risposto: Stephen23 il 4 Mar 2021
I need to plot this function C(z,t) with changing t at 0, 0.000225, 0.00045, and 0.00113 for a total of 4 lines. I know the hold on function is necessary but not sure how to use it poroperly. This is what i have for t=0 so far:
z = 0:0.001:1;
t = 0;
C = (sin(3*pi*z)*exp(-50*(3*pi)^2*t))-(sin(9*pi*z)*exp(-50*(9*pi)^2*t));
figure
plot(z,C)
xlabel('z')
ylabel('C(z,t)')
grid

Risposta accettata

Stephen23
Stephen23 il 4 Mar 2021
t = [0,0.000225,0.00045,0.00113];
z = 0:0.001:1;
z = z(:);
C = (sin(3*pi*z).*exp(-50*(3*pi)^2.*t))-(sin(9*pi*z).*exp(-50*(9*pi)^2.*t));
plot(z,C)
xlabel('z')
ylabel('C(z,t)')
grid on

Più risposte (0)

Categorie

Scopri di più su Specifying Target for Graphics Output in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by