no line on graph

2 ビュー (過去 30 日間)
Darren Kunz
Darren Kunz 2019 年 7 月 4 日
コメント済み: Star Strider 2019 年 7 月 5 日
I am relatively new to matlab and am trying to figure things out.
I tried the following script but the graph shows no lines. the absolute value of x1/x2 is a function of w.
Can anyone help?.........Thank you in advance!!!
clc
clear
m1=550;
m2=300;
w=linspace(0,10,1000);
k1=60;
k2=50;
k3=40;
A=(-m1*w.^2 + k1 +k3);
B=k3;
C=k3;
D=(-m2*w.^2 + k2 +k3);
E=(B*C)-(A.*D);
P0=1000;
K=P0
x1=K*(-D./E);
x2=K*(C./E);
X=abs(x1/x2)
plot(w,X,'g')

採用された回答

Star Strider
Star Strider 2019 年 7 月 4 日
You vectorised everything else, and then forgot to vectorise the division in your ‘X’ assignment:
X=abs(x1./x2);
Your code now plots your line.
  3 件のコメント
Star Strider
Star Strider 2019 年 7 月 5 日
My pleasure.
Definitely!
Star Strider
Star Strider 2019 年 7 月 5 日
If my Answer helped you solve your problem, please Accept it!

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by