# Plot function shows an incomplete output

7 visualizaciones (últimos 30 días)
Sagar D Patel el 29 de Jun. de 2020
Comentada: Sagar D Patel el 29 de Jun. de 2020
Hello,
I have a simple function created titled Pcg:
function f = Pcg(Pe)
f = sqrt(Pe./4.0+1.273).*1.11;
I aim to call it in the code below to obtain an output of the dotted curve, d, shown in the attached image:
pe_plot = linspace(0,1000,10000);
plot(sort(pe_plot),Pcg(sort(pe_plot)));
xlim([0.01,1000])
ylim([0.1,30])
set(gca,'xscale','log')
set(gca,'yscale','log')
I am however obtaining a blank region in the plot for x-values between 0.01 and 0.1. This also got me thinking that I'm probably goofing up big time in using linspace for plotting. The curve shown in the attached image is just a prediction curve, where values on the y-axis are plotted as function of an array of values on the x-axis.
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

RAVIKIRAN YALAMARTHI el 29 de Jun. de 2020
Create a linspace array which matches the log sclae for x- axis values. (Since, you set the xlim as [0.01,1000])
pe_plot = linspace(0.010,1000,10000)
plot(sort(pe_plot),Pcg(sort(pe_plot)),'--')
to add '+' marking on dashep plot,
hold on
s = [0.01 0.1 1 5 10 50 100 500 1000]
plot(s,Pcg(s),'+r')
hold off
and remaining code is as it is to get the curve 'd' as shown in image
xlim([0.01,1000])
ylim([0.1,30])
set(gca,'xscale','log')
set(gca,'yscale','log')
function f = Pcg(Pe)
f = sqrt(Pe./4.0+1.273).*1.11;
end
##### 1 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
Sagar D Patel el 29 de Jun. de 2020
Thank you, Ravi!

Iniciar sesión para comentar.

### Categorías

Más información sobre Graphics Object Identification en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by