how can use changing input when calling function? problem having have write code in matlab explicit method parabolic partial differential equations , initial condition u(x,0) =sin(pi*x)
when calling function write
explicit( 0,0,sin(pi*x),0,0,1,0,1,3,2,0.25,0.25)
the rest of input functions refers different values , boundary conditions.
where sin(pi*x) refers problem area of code me. in code self write boundary condition
for j = 1:(n+2) = (n+2) x = (a -h) + h*j u(i,j) = y_below end y_below refers u(x,0) = sin(pi*x)
this works how want when boundary condition y_below equal number. not know how use changing x when calling function
i have tried google , closest can varargin not know how use it. new matlab , first program have had write assignment. appreciated!
i not sure if looking but
if define function follows:
function output = myfunction(input1, input2, varargin) then varargin infunction argument collects all
other arguments apart form input1, input2. means that
if call function below:
outp = myfunction(inp1, inp2, inp3, inp4, inp5); then within function following hold:
input1 = inp1; input2 = inp2; varargin{1} = inp3; varargin{2} = inp4; varargin{3} = inp5; you can check (within function) number of passed arguments nargin.
Comments
Post a Comment