return value did not change
Info
This question is closed. Reopen it to edit or answer.
Show older comments
hye, here is my code, other variable is working except for r(i+1),it return the same value for i=0 until 100 ,can someone tell me how to solve this?
function [Resistant ] = resistance(w,l,h)
G = 1.59*10.^-8;
u =pi*4*10.^-7;
p= 6.30 *10.^7;
f = 0:100;
for i= 0:100;
q(i+1)=(2/(2*pi*f(i+1)*u*G)).^(1/2);
v(i+1) =1-exp(-h/q(i+1));
r(i+1)= w*q(i+1)*v(i+1)
Resistant(i+1) = p*l/r(i+1);
end
end
3 Comments
Stephen23
on 4 Apr 2018
@rose wright: please give us the exact values of w, l, and h that you used.
rose wright
on 4 Apr 2018
Adam
on 4 Apr 2018
If you are so certain r(i+1) is the same for every i I assume you are using the debugger so surely it is easy to see what the problem is if you are? Just look at its components on the command line each time round the loop.
If it isn't changing it suggests that q * v is constant for each iteration.
Answers (0)
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!