please help me with this

I plotted the graph as:
beta = 0; % Pitch angle
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)));
ind2=ind2+1;
end
tab_lambda=[0.1:0.01:11.8];
% Kopt for MPPT (maximum power point tracking)
Cp_max=0.44;
lambda_opt=7.2;
kopt = ((0.5*ro*pi*(Radius^5)*Cp_max)/(lambda_opt^3));
figure
subplot(1,3,3)
plot(tab_lambda,Cp,'linewidth',1.5)
xlabel('lambda','fontsize',14)
ylabel('Cp','fontsize',14)
Now, I want the graph to be like this:
What I must change in the code to plot this new graph???
Please help me.

2 comentarios

Image Analyst
Image Analyst el 29 de Dic. de 2020
Doesn't run. What is ro and Radius?
rami shaker
rami shaker el 29 de Dic. de 2020
Radius = 46;
ro = 1.225;

Iniciar sesión para comentar.

Respuestas (2)

Alan Stevens
Alan Stevens el 29 de Dic. de 2020
Editada: Alan Stevens el 29 de Dic. de 2020

0 votos

Simply insert
hold
xvals = [0 7.2 7.2]; yvals = [0.36 0.36];
plot(xvals,yvals,'--')
after your plot command (though the peak of the first curve you showed is higher than 0.36).

4 comentarios

rami shaker
rami shaker el 29 de Dic. de 2020
the first curve the peak is y=0.44 at x=7.2
but i want the peak will be y=0.36 at x=7.2 (2nd graph)
rami shaker
rami shaker el 29 de Dic. de 2020
it will draw a dot , not a curve
rami shaker
rami shaker el 29 de Dic. de 2020
it will draw a dot not a curve
rami shaker
rami shaker el 29 de Dic. de 2020
Editada: Image Analyst el 29 de Dic. de 2020
I want that the curve will be like this (if you understand the issue)

Iniciar sesión para comentar.

Steven Lord
Steven Lord el 29 de Dic. de 2020
This doesn't quite do exactly what you want but it's close.
% Define the curve
x = 0:0.25:10;
y = 50-(x-4).^2;
% Plot it
plot(x, y);
hold on
% Find the peak
[maxY, maxYLoc] = max(y);
% Plot the dashed lines and the "x marks the spot"
xline(x(maxYLoc), '--')
yline(maxY, '--')
plot(x(maxYLoc), maxY, 'x')
% Set the limits so there's room to see the horizontal dashed line
ylim([0 60])

5 comentarios

rami shaker
rami shaker el 29 de Dic. de 2020
there is an error with your code:
Undefined function or variable 'xline'.
Error in int3 (line 13)
xline(x(maxYLoc ), '--')
Walter Roberson
Walter Roberson el 29 de Dic. de 2020
https://www.mathworks.com/help/matlab/ref/xline.html
R2018b or later
rami shaker
rami shaker el 29 de Dic. de 2020
Cp(ind2)=0.73.*(151./lambdai(ind2)-0.58.*beta-0.002.*beta^2.14-13.2).*(exp(-18.4./lambdai(ind2)));
i want this equation to be drawn not this one: y = 50-(x-4).^2
Image Analyst
Image Analyst el 29 de Dic. de 2020
Editada: Image Analyst el 29 de Dic. de 2020
What are those things? Is lambdai() a function or a vector? What is the "x" value -- ind2 or beta? Are ind2 and beta vectors or scalars?
How about this:
plot(allInd2Values, Cp, 'b-', 'LineWidth', 2);
grid on;
xlabel('ind2');
ylabel('Cp');
rami shaker
rami shaker el 29 de Dic. de 2020
beta = 0; % Pitch angle
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)));
ind2=ind2+1;
end
tab_lambda=[0.1:0.01:11.8];
% Kopt for MPPT (maximum power point tracking)
Cp_max=0.44;
lambda_opt=7.2;
kopt = ((0.5*ro*pi*(Radius^5)*Cp_max)/(lambda_opt^3));
figure
subplot(1,3,3)
plot(tab_lambda,Cp,'linewidth',1.5)
xlabel('lambda','fontsize',14)
ylabel('Cp','fontsize',14)
i want to modify this code to plot the second curve with peak of 0.36 at x=7.2

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 29 de Dic. de 2020

Comentada:

el 29 de Dic. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by