5 views (last 30 days)

i have written

z=100;

for x=1:1:20

y=x*x

if y==z

fprintf(x)

end

end

Stephen Cobeldick
on 18 Sep 2020

Edited: Stephen Cobeldick
on 18 Sep 2020

>> f = @(x) x.^2 - 100;

>> x = fzero(f,pi)

x = 10

Stephen Cobeldick
on 18 Sep 2020

This

@(x) x.^2 - 100

defines an anonymous function:

fzero uses that function to find the zero crossing (i.e. the input value for which the function output is zero).

Opportunities for recent engineering grads.

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

Start Hunting!
## 0 Comments

Sign in to comment.