Plotting multiple lines on one graph

1 visualización (últimos 30 días)
Will Jeter
Will Jeter el 4 de Mzo. de 2021
Respondida: Stephen23 el 4 de Mzo. de 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

Respuesta aceptada

Stephen23
Stephen23 el 4 de Mzo. de 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

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by