How to divide a vector by a constant?
1 回表示 (過去 30 日間)
古いコメントを表示
Lance Shallenberger
2021 年 9 月 16 日
コメント済み: Lance Shallenberger
2021 年 9 月 16 日
c=3*10^8
speeds=(.1*c:.9*c/8:.9*c)
y=1/sqrt(1-(speeds.^2./c^2))
What is my error?
0 件のコメント
採用された回答
Image Analyst
2021 年 9 月 16 日
The denominator with sqrt() is a vector so you need a dot before the slash
y = 1 ./ sqrt(1 - (speeds .^ 2 ./ c ^ 2))
その他の回答 (1 件)
Cris LaPierre
2021 年 9 月 16 日
You need to use elementwise division everywhere in your equation for y
c=3*10^8;
speeds=(.1*c:.9*c/8:.9*c);
% v
y=1./sqrt(1-(speeds.^2./c^2))
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!