Plot function shows an incomplete output
6 ビュー (過去 30 日間)
古いコメントを表示
Sagar D Patel
2020 年 6 月 29 日
コメント済み: Sagar D Patel
2020 年 6 月 29 日
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 件のコメント
採用された回答
RAVIKIRAN YALAMARTHI
2020 年 6 月 29 日
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
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Graphics Object Identification についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!