Calculation problem. it gives value instead of array

I want to plot three bar mechanism location graph. So i wrote the formulas but when i tried to calculate teofi, it gives me only one value. The other ones is giving an array. I dont understand the problem. If you help me, i glad.

 採用された回答

Voss
Voss 2022 年 3 月 26 日

1 投票

Try using element-wise division ( ./ ) and see if that gives you the expected result.
fi = 20:pi/30:60;
r1 = 0.40;
r2 = 2;
r3 = 2;
r4 = 0.30;
A = sind(fi);
B = cosd(fi) - (r1/r2);
D = (r1/r4) * cosd(fi) - (r1.*2 + r2.*2 - r3.*2 + r4.*2) / (2*r2*r4);
teofi = 2 * atand( (A-(A.*2 + B.*2 - D.*2).*(0.5) ) ./ ( B - D ) )
teofi = 1×382
-90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000 -90.0000

1 件のコメント

cakirenes
cakirenes 2022 年 3 月 26 日
thanks bro, you helped me alot.I changed the atand formula also. İf you want to plot, you can plot like this
teofi = 2 * atand( (A + (A.*2 + B.*2 - D.*2).*(0.5) ) ./ ( B - D ) )
plot(fi,teofi)

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeIntroduction to Installation and Licensing についてさらに検索

質問済み:

2022 年 3 月 26 日

コメント済み:

2022 年 3 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by