return value did not change
Informazioni
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Mostra commenti meno recenti
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 Commenti
Stephen23
il 4 Apr 2018
@rose wright: please give us the exact values of w, l, and h that you used.
rose wright
il 4 Apr 2018
Adam
il 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.
Risposte (0)
Questa domanda è chiusa.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!