Error when plotting.... No points shown in graph

Hello! I am having trouble plotting my graph. Here is my code. It shows the graph but nothing is plotting. Any idea what is happening? Please let me know! Thank you
xlabel('Time')
ylabel('Thrust')
title('Thrust Varying With Time')
x = linspace(0,0.001,1);
y = linspace(0,5,500);
A = (pi*(.021336)^2)/4;
Po = 400000;
Patm = 101325;
f(x)= (2*(Po-Patm)*A)*x;
plot (x,f(x))

回答 (2 件)

Ameer Hamza
Ameer Hamza 2020 年 9 月 27 日
編集済み: Ameer Hamza 2020 年 9 月 27 日

0 投票

The left side of the line
f(x)= (2*(Po-Patm)*A)*x;
is not correct. f(x) represent indexing into f using x vector, which is only allowed if all values in x are integers. You don't need that here. Check this code
x = linspace(0,0.001,100);
A = (pi*(.021336)^2)/4;
Po = 400000;
Patm = 101325;
f = (2*(Po-Patm)*A)*x;
plot(x, f)
xlabel('Time')
ylabel('Thrust')
title('Thrust Varying With Time')

2 件のコメント

Rose Carroll
Rose Carroll 2020 年 9 月 27 日
thank you so much!
Ameer Hamza
Ameer Hamza 2020 年 9 月 27 日
I am glad to be of help!!! :)

サインインしてコメントする。

Permesh Lal Jethi Amrick Lall
Permesh Lal Jethi Amrick Lall 2023 年 9 月 1 日

0 投票

Hello, I am plotting a root locus graph based on the following code:
num=[1];
den=[1 3 0];
sys=tf(num,den)
rlocus(sys)
My plot appears but empty. No data.

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

タグ

質問済み:

2020 年 9 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by