Looping a function in MATHLAB

1 visualización (últimos 30 días)
Prince Igweze
Prince Igweze el 4 de Abr. de 2020
Respondida: David Hill el 4 de Abr. de 2020
Please, how can I loop this function
function y = f(x)
y = sqrt(1 - (x^2)*(Z^2));
end
to solve for different values if Z (ie Z(i))
Thank you

Respuestas (1)

David Hill
David Hill el 4 de Abr. de 2020
No loop needed, just provide Z array to function. Output, y will contain the array of corresponding outputs for the different Z's given the x-value.
function y = f(x,Z)
y = sqrt(1 - (x^2)*(Z.^2));
end

Categorías

Más información sobre Loops and Conditional Statements 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