matlab not plotting graph
2 ビュー (過去 30 日間)
古いコメントを表示
Any ideas why matlab wont plot this? only getting one value for z but thats not appearing graph either. Where have i gone wrong?
h = [2,4,6,8,10];
x = 10.1;
y = 2.5;
z = (x * h.^2 - x - sqrt(y^2*h.^2 - y^2)) / (h.^2 -1);

0 件のコメント
回答 (2 件)
Rafael Hernandez-Walls
2021 年 8 月 2 日
You need one point in the equation of z
h = [2,4,6,8,10];
x = 10.1;
y = 2.5;
z = (x * h.^2 - x - sqrt(y^2*h.^2 - y^2))./ (h.^2 -1);
plot(h,z)
0 件のコメント
the cyclist
2021 年 8 月 2 日
編集済み: the cyclist
2021 年 8 月 2 日
You are using a matrix division operation rather than an elementwise division. So you need,
h = [2,4,6,8,10];
x = 10.1;
y = 2.5;
z = (x * h.^2 - x - sqrt(y^2*h.^2 - y^2)) ./ (h.^2 -1) % Notice the ./ in this line
plot(h,z)
0 件のコメント
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!