total = 0;
err = 0;
bvals = 0:1:40;
for b = bvals
subtotal = 0;
for i= 0:1:50
f1 = @(o,i) (sind(b+i) + sind(b-o)) -( 1.180/0.04 + sqrt.((1.140/0.04 - 2*sind(b)).^2 - (cosd(b-o)- cosd(b+i)).^2));
f2 = @(p,i) cotd(p-3.34) - cotd(i-1.07) - (1.180/(1.540 - 0.300));
subtotal = subtotal + (o - p).^2;
end
err = sqrt(subtotal/50);
plot(bvals,err);
hold on
total = total + subtotal;
end
But why do you define f1 and f2 when you do not use them? And you have not defined o or p but you try to add their squared difference to the total?
1 Comment
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/378162-implicit-function-inside-a-loop#comment_526761
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/378162-implicit-function-inside-a-loop#comment_526761
Sign in to comment.