Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: how import a variable from script file to function file?
Replies: 3   Last Post: May 15, 2013 12:31 PM

 Messages: [ Previous | Next ]
 ghasem Posts: 118 Registered: 4/13/13
Re: how import a variable from script file to function file?
Posted: May 15, 2013 8:38 AM

is there anyone who help me?
How import a "i" index from script to function?
I need to import "i" index from script to function,where function include a two equation two variable.
for example my function is as following:
%
function output = func_bedune_dielec(inputs)
realPartOfInput = inputs(1);
imagPartOfInput = inputs(2);
% k1 , k2 , are known.and w is a vector that length(w)=100.
% namely : w =linspace(1,5,100);
kz = complex(realPartOfInput, imagPartOfInput);
er = 1-w(i)^2;
k2 = k1*sqrt(er);
g1 = er*sqrt(kz^2-k3^2).*besseli(1,sqrt(-kz^2-k2^2)).*besselk(0,sqrt(-kz^2-k3^2))+... sqrt(-kz^2-k2^2).*besseli(0,sqrt(-kz^2-k2^2)).*besselk(1,sqrt(-kz^2-k3^2));
output = [ real(g1); imag(g1)];

%
in fact,when function in FSOLVE is called,I want to use from w(i) in my function,so that "i" is for loop index of my script.
how import "i" index value from script to function,when function is called?
ghasem

Date Subject Author
5/15/13 ghasem
5/15/13 ghasem
5/15/13 Steven Lord
5/15/13 ghasem