return value did not change

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 Kommentare

Stephen23
Stephen23 am 4 Apr. 2018
@rose wright: please give us the exact values of w, l, and h that you used.
rose wright
rose wright am 4 Apr. 2018
here is the value
resistance(5*10.^-5,0.248,5*10.^-5)
Adam
Adam am 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.

Antworten (0)

Diese Frage ist geschlossen.

Tags

Gefragt:

am 4 Apr. 2018

Geschlossen:

am 20 Aug. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by