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일
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

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 Exchange에서 Introduction 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