cosine of a matrix returns weird values.

4 ビュー (過去 30 日間)
Wouter
Wouter 2025 年 1 月 20 日
コメント済み: Wouter 2025 年 1 月 20 日
I'm trying to plot a few forces that chance because of an angle. I've defined the changing angle as beta which is a matrix. Than i'm calcultating two different angles which matter for the calculation of the forces. And for these forces i need, for example, the cosine of angle alpha. The angle of alpha changes between 90 and 0 degrees. But if i take the cosine of this matrix it returns weird numbers. Negative numbers, like -0.4481. It should start at 90 and cosine 90 equals 0 but it doesn't. Does anyone know what is going on?
Fad = 240
Fad = 240
beta = 0:1:180; % Angles
gamma = 180 - beta;
alpha = 0.5.*gamma;
w = cos(alpha); % Cosine and tanges of said angles
x = cos(gamma);
y = tan(alpha);
z = tan(gamma);
Fvloer1 = Fad./w; % Calculations of different forces
Fvloer2 = Fvloer1.*x; % Almost all forces are matrices except for Fad which is a constant.
Fl = Fad.*y;
Ft = Fvloer2.*z;
figure % Plots of these forces against an angle
plot(beta,Fvloer1)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid on
figure
plot(beta,Fvloer2)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid on
figure
plot(beta,Fl)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid on
figure
plot(beta,Ft)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid on

採用された回答

Torsten
Torsten 2025 年 1 月 20 日
編集済み: Torsten 2025 年 1 月 20 日
"cos" and "tan" can be applied to angles in radians, not in degrees. Use "cosd" and "tand" instead.
  1 件のコメント
Wouter
Wouter 2025 年 1 月 20 日
Came to the same conclusion, Thanks!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInstall Products についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by