i have a code below which plot the first curve, please help me to change this code to plot the second curve

beta = 0;
ind2 = 1;
for lambda=0.1:0.01:11.8
lambdai(ind2) = (1./((1./(lambda-0.02.*beta)+ (0.003./(beta^3+1)))));
Cp(ind2)=0.73.*(151./lambdai(ind2)-0.58.*beta-0.002.*beta^2.14-13.2).*(exp(-18.4./lambdai(ind2)));
Ct(ind2)=Cp(ind2)/lambda;
ind2=ind2+1;
end
tab_lambda=[0.1:0.01:11.8];
subplot(1,3,3)
plot(tab_lambda,Cp,'linewidth',1.5)
xlabel('lambda','fontsize',14)
ylabel('Cp','fontsize',14)

댓글 수: 2

What have you tried and where did you have a problem?
HINT: See
doc yyaxis
for some ideas, maybe...
this code plot the first curve, i want to modify this code to plot the second curve with a peak of y=0.36

댓글을 달려면 로그인하십시오.

 채택된 답변

Try this:
fprintf('Beginning to run %s.m ...\n', mfilename);
fontSize = 20
beta = 0;
ind2 = 1;
tab_lambda=[0.1:0.01:11.8];
for k = 1 : length(tab_lambda)
lambda = tab_lambda(k);
fprintf('lambda = %.2f\n', lambda);
lambdai(ind2) = (1./((1./(lambda-0.02.*beta)+ (0.003./(beta^3+1)))));
Cp(ind2)=0.73.*(151./lambdai(ind2)-0.58.*beta-0.002.*beta^2.14-13.2).*(exp(-18.4./lambdai(ind2)));
Ct(ind2)=Cp(ind2)/lambda;
ind2=ind2+1;
end
subplot(2, 1, 1)
plot(tab_lambda, Cp, 'linewidth', 2)
grid on;
xlabel('lambda','fontsize',14)
ylabel('Cp','fontsize',14)
title('Cp', 'FontSize', fontSize);
subplot(2, 1, 2)
plot(tab_lambda, Ct, 'linewidth', 2)
grid on;
xlabel('lambda','fontsize',14)
ylabel('Ct','fontsize',14)
title('Ct', 'FontSize', fontSize);
g = gcf;
g.WindowState = 'maximized';
fprintf('Done running %s.m.\n', mfilename);

댓글 수: 5

the peak value of Cp is also 0.44 but i want a peak of 0.36
as the curve below (asd.jpg)
The equations you gave do not create a max of 0.36. Are you sure your equations are correct?
i want to modify these equations to have a max of 0.36
After the loop, you can use rescale to rescale the vector
Cp = rescale(Cp, 0, 0.36);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

질문:

2021년 1월 10일

댓글:

2021년 1월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by