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 件のコメント

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

回答 (0 件)

この質問は閉じられています。

タグ

質問済み:

2018 年 4 月 4 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by