Plotting multiple lines on one graph

1 次查看(过去 30 天)
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

采纳的回答

Stephen23
Stephen23 2021-3-4
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Specifying Target for Graphics Output 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by