|
hello dear,
thanks for you response , i have checked the error ,
it is ok, how i can get specific value of v from the vector having different values of v to be used in the equation in eg (eq for ode solver).
"Nasser M. Abbasi" <nma@12000.org> wrote in message <qG2Im.43$gg6.15@newsfe25.iad>...
>
> "Tariq " <t.umer@lancaster.ac.uk> wrote in message
> news:hcpt4o$n8b$1@fred.mathworks.com...
> >i have problem in my program
> > i created one variable 'v' in main file , the value of that variable is
> > used in the equation in other program as global variable.
> >
> > when i run main program having ode45 solver for that equation having
> > variable 'v' it gives error
> > ??? Error using ==> odearguments at 117
> > Solving EGG2 requires an initial condition vector of length 1.
> > can any body guide me about this.
> >
> > is there is way to use value of one variable in other function (equation)
> > which will be solved through ODE solver.
> > my code is
> >
> > main program
> > --------------------
> > clc;
> > clear all;
> > global v;
> > x=[-1;1];
> > v= 2*x;
> > [x,y]= ode45(@eg,[-1 1],[0.1],v);
> > plot (x,y);
> > --------------
> > function dy =eg(x,y)
> > global v;
> > dy= -v*y + x;
> > end
>
> The problem is in your eg function.
> When you type "v*y", notice that v is a vector of length 2, so this causes
> dy to become a vector of length 2, hence the problem.
>
> I do not know what you are doing here. And why you are passing 'v' to ode45
> since it is allready global. try v scalar, and try this
>
> v= 99;
> [x,y]= ode45(@eg,[-1 1],[0.1]);
>
> --Nasser
>
>
|