MATLAB Answers

Looping a function in MATHLAB

3 views (last 30 days)
Prince Igweze
Prince Igweze on 4 Apr 2020
Answered: David Hill on 4 Apr 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

  0 Comments

Sign in to comment.

Answers (1)

David Hill
David Hill on 4 Apr 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

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!