MATLAB: I want to write a code where equation is y=x*x. if y=100 what is the value of x

if loop

i have written
z=100;
for x=1:1:20
y=x*x
if y==z
fprintf(x)
end
end

Best Answer

>> f = @(x) x.^2 - 100;
>> x = fzero(f,pi)
x = 10
Related Question