How do you write a pde func for a variable v in matlab, where the v is experimental data that are to be fit in a pde function to extrapolate the data. fro a longer time.?

1 view (last 30 days)
How do you write a pde func for a variable v in matlab. The PDE equation is as follows, I simplified it with all the constants put and finally resulted in this: dv/dt=k(2-2.37v)/2.12
here the basic thing is v are experimental values which are varied with time (h) and need to fit those values or data in to the above function and extrapolate it for some days. Any advice or idea is accepted. Thank you

Accepted Answer

Bruno Pop-Stefanov
Bruno Pop-Stefanov on 6 Oct 2014
Dinesh,
Are you trying to simulate the evolution of a differential equation? Are you trying to solve the equation?
The differential equation:
is ordinary, not partial.
If you want to solve this equation and plot v(t) over time to compare the solution to the experimental values, you can use the dsolve function of Symbolic Math Toolbox.
The documentation page for dsolve contains examples to show you how to solve an ordinary differential equation. In addition, you can also take a look at this example page:
For example, you could solve the ODE above as follows:
>> syms k x(t)
>> S = dsolve(diff(x) == k*(2-2.37*x)/2.12)
S =
(C3*exp(-(237*k*t)/212))/237 + 200/237
Then, if you want to evaluate it, use matlabFunction to convert the expression to a function of C3, k and t:
>> v = matlabFunction(S)
v =
@(C3,k,t)C3.*exp(k.*t.*(-2.37e2./2.12e2)).*(1.0./2.37e2)+2.0e2./2.37e2
You can now evaluate it. For example, for C3 and k equal to 1:
>> t = 0:0.01:10;
>> y = v(1,1,t);
Now display the plot:
>> plot(t,y)

More Answers (0)

Community Treasure Hunt

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

Start Hunting!