How to use the Sum function in this instance

16 visualizaciones (últimos 30 días)
Ahmed Alzaabi
Ahmed Alzaabi el 8 de Feb. de 2023
Respondida: Image Analyst el 9 de Feb. de 2023
Hello, Ive been writing code for one of my modules and came across a formula that I dont understand how to put it in matlab, it is this equation below:
My problem is that I dont understand how to use the sum function in this instance
  4 comentarios
Torsten
Torsten el 8 de Feb. de 2023
Are you sure you included the correct code ?
And you didn't tell us about x and z.
So far I can see that if a = 0 as in your code, d_eps_alpha will also be 0.
Ahmed Alzaabi
Ahmed Alzaabi el 8 de Feb. de 2023
I didn't put the values in yet that's why all of the variables are 0. All of the values are scalar meaning they will hold 1 value only, that's why initially I didn't put my code as I have all of the values of the variable shown in the equation above. I just need help setting that equation in terms of matlab code.

Iniciar sesión para comentar.

Respuesta aceptada

Image Analyst
Image Analyst el 9 de Feb. de 2023
Take it one term at a time, like
fi = 5 : 85;
term1 = 0.5 * cosd(fi) .^ 2
term2 = whatever
numerator = whatever
denominator = whatever
d = scalingFactor * sum(numerator ./ denominator);
I know you can do it. I have confidence in you.

Más respuestas (1)

Matt J
Matt J el 8 de Feb. de 2023
Editada: Matt J el 8 de Feb. de 2023
Assuming all your variables (x,z,Ar, etc...) are scalars, then,
fi=5:85;
q1=0.5*cosd(fi).^2;
q2=q1+z^2;
q3=sqrt(x^2+q2);
d=(a/pi^2/Ar)*sum( (q1./q3).*( (x+q3)./q2 +x./(x^2+z^2) ) ) * pi/180
  2 comentarios
Paul
Paul el 8 de Feb. de 2023
Missing "a" out front?
Matt J
Matt J el 8 de Feb. de 2023
Yep. Fixed it.

Iniciar sesión para comentar.

Categorías

Más información sobre Guidance, Navigation, and Control (GNC) en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by