I need some help please!

2 visualizaciones (últimos 30 días)
Daniel Vonderhaar
Daniel Vonderhaar el 7 de Jun. de 2021
Comentada: Walter Roberson el 20 de Jun. de 2021
Hello!
I got this as an exsample, but I dont know how to get the solution for these questions. Would one of you please help?
  4 comentarios
David Hill
David Hill el 7 de Jun. de 2021
James Tursa
James Tursa el 7 de Jun. de 2021
You plug in the known numbers and then solve the equation for the remaining unknown.

Iniciar sesión para comentar.

Respuesta aceptada

Daniel Vonderhaar
Daniel Vonderhaar el 20 de Jun. de 2021
I figured it out!
%% Part 1
a=21;
b=45;
c=60;
%Human Steps
%60^2=21^2+45^2-2(21)(45)cos(y);
%3600=2466-1890cos(Y);
%1134=-1890cos(y);
%Y= 126.87;
%Computer Steps
%c^2=a^2+b^2-2*a*b*cosd(gamma)
%c^2-a^2=b^22*a*b*cosd(gamma)
%c^2-a^2-b^2=-2*a*b*cosd(gamma)
%(c^2-a^2-b^2)/(-2*a*b)=cosd(gamma)
%cosd(gamma)=(c^2-a^2-b^2)/(-2*a*b)
%acosd(cosd(gamma))=acosd((c^2-a^2-b^2)/(-2*a*b))
gamma=acosd((c^2-a^2-b^2)/(-2*a*b))
%% Part 2
%b/sind(beta)=c/sind(gamma)
%b=(c*/sind(gamma))*sind(beta)
%b*(sind(gamma)/c)=sind(beta)
%sind(beta)=b*(sind(gamma)/c)
%asind(sind(beta))=asind(b*(sind(gamma)/c))
%beta=asind(b*(sind(gamma)/c))
beta=asind(b*(sind(gamma)/c))
%a/sind(alpha)=b/sind(beta)
%a=(b*/sind(beta))*sind(alpha)
%a*(sind(beta)/b)=sind(alpha)
%sind(alpha)=a*(sind(beta)/b)
%asind(sind(alpha))=asind(a*(sind(beta)/b))
%alpha=asind(a*(sind(gamma)/b))
alpha=asind(a*(sind(beta)/b))
%% Part 3
Vertification=alpha+beta+gamma
solve_gamma=180-alpha-beta
solve_beta=180-gamma-alpha
solve_alpha=180-gamma-beta
disp [This is correct]
  2 comentarios
John D'Errico
John D'Errico el 20 de Jun. de 2021
LOL. Usually, we don't encourage people to answer questions posted with no effort shown by the student. But since you answered your own question. I guess that is ok. :)
If I can offer some getting started advice...
You used the variables alpha, beta, gamma. And while they may seem perfectly valid variable names, at the same time, they are also MATLAB functions, every one of them. At this point in your career, you won't be using the gamma or beta functions. But one day you may need to do so. ANd alpha is a graphics utility. Try this:
help alpha
help beta
help gamma
In each case, you will find functions in MATLAB that MAY come in quite handy one day.
A good idea when you use a variable name that seems like a common word, you might check to see if it already exists as a function in MATLAB.
Walter Roberson
Walter Roberson el 20 de Jun. de 2021
In practice, using alpha tends to cause problems: it is a common failure to encounter a point in a program where alpha has not been defined, and then to have MATLAB error with a confusing error message when alpha gets used. For example,
bx = x.^(1-alpha)
with alpha not having been defined as a variable, will generate an error about "Too many output arguments".
If beta or gamma are used in the same kind of circumstances, the error is instead about "Not enough input arguments" which tends to be easier to understand.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by