cosine of a matrix returns weird values.

2 views (last 30 days)
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

Accepted Answer

Torsten
Torsten on 20 Jan 2025
Edited: Torsten on 20 Jan 2025
"cos" and "tan" can be applied to angles in radians, not in degrees. Use "cosd" and "tand" instead.

More Answers (0)

Categories

Find more on Animation in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!