Plotting multiple lines on one graph

2 views (last 30 days)
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

Accepted Answer

Stephen23
Stephen23 on 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

More Answers (0)

Categories

Find more on Specifying Target for Graphics Output in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!