Plotting multiple lines on one graph

조회 수: 2 (최근 30일)
Will Jeter
Will Jeter 2021년 3월 4일
답변: Stephen23 2021년 3월 4일
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에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by