Trying to calculate the outputs for this equation in a for loop, but it only calculates for one input; when g = 1.67

1 vue (au cours des 30 derniers jours)
M = 2;
g = linspace(1,1.67,4)';
for i = 1:length(g)
beta_max = asind((g(i)+1)./(4*g(i))-1./(g(i).*M^2)*(1-((g(i)+1)*(1+(g(i)-1)/2*M^2+(g(i)+1)/16*M^4))^0.5));
end

Réponses (1)

Voss
Voss le 1 Mar 2023
M = 2;
g = linspace(1,1.67,4)';
beta_max = zeros(size(g));
for i = 1:length(g)
beta_max(i) = asind((g(i)+1)./(4*g(i))-1./(g(i).*M^2)*(1-((g(i)+1)*(1+(g(i)-1)/2*M^2+(g(i)+1)/16*M^4))^0.5));
end
beta_max
beta_max = 4×1
59.5840 56.4864 54.4023 52.8937

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by