Error using / Matrix dimensions must agree for Vr

clc
clear all
close all
Vo= 10;
R= 1;
x = linspace(-4,4,1000);
y = linspace(-4,4,1000);
r = sqrt(x.^2 +y.^2);
theta = atan(y/x);
Vr = 1-((R^2)/(r.^2))*Vo*cos(theta);
% Vt = -(1- (R^2/r.^2)*Vo*sin(theta));
% Vx = (Vr*cos(theta) - Vt*sin(theta));
% Vy = (Vr*sin(theta) - Vt*cos(theta));
disp(Vr);

 採用された回答

Star Strider
Star Strider 2020 年 10 月 11 日

1 投票

Vectorise!
Vr = 1-((R^2)./(r.^2)).*Vo.*cos(theta);
HERE
That should do what you want.
See Array vs. Matrix Operations for details.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

質問済み:

2020 年 10 月 11 日

回答済み:

2020 年 10 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by