ode,dsolve,spline,ode interp, differantial
Afficher commentaires plus anciens
x=[0:0.5:3]
M=[0 1 4.5 12.75 25 41 62]
dQ/dx=M
How can i solve this diff equation. My code is below
x=[0:0.5:3]
M=[0 1 4.5 12.75 25.1 41 62]
k=spline(x,M)
[x,Q] = ode45(@(x,Q) k, [0 3], 0);
it does not work
I dont have function ı have data x and data M. I use these datas with spline.
is there any way to solve this question in ODE, dsolve, deval or anything else?
Réponse acceptée
Plus de réponses (1)
Alan Stevens
le 4 Août 2020
More like this perhaps:
xspan = [0 3];
Q0 = 0;
[x, Q] = ode45(@f, xspan, Q0);
plot(x,Q), grid
xlabel('x'), ylabel('Q')
function dQdx = f(x,~)
X=0:0.5:3;
M=[0 1 4.5 12.75 25 41 62];
dQdx = spline(X,M,x);
end
1 commentaire
esat gulhan
le 4 Août 2020
Catégories
En savoir plus sur Spline Postprocessing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
