i want to code following kind of differential eqn in my script file
[t,y]=ode(@(t,y) [[qin-k{y^1.5- (y-b)^1.5}] /Area],t1span,h0)
where, b=f(t)=8.89e-5*t^3 - 4.57e-3*t^2 + 2.27e-1*t - 9.52e-3
area = f(y) = (1.6e-3*y^4 - 2.76e-2*y^3+ 1.4e-1*y^2 - 1.1e-1*y + 0.287)*1e6
when i substitute b and area in my DE, it gets very long and so messy. How can i pre-define b as f(t) and area as f(y) so that i can write my DE eqn in terms of b and area, not in the expanded terms of t and y

 Réponse acceptée

Guillaume
Guillaume le 24 Fév 2018
b = @(t) 8.89e-5*t^3 - 4.57e-3*t^2 + 2.27e-1*t - 9.52e-3;
area = @(y) (1.6e-3*y^4 - 2.76e-2*y^3+ 1.4e-1*y^2 - 1.1e-1*y + 0.287)*1e6
%taking a guess at the DE since you didn't use valid matlab syntax
[t, y] = ode(@(t, y) qin-k*(y^1.5- (y-b(t))^1.5) / Area(y), t1span, h0);
Not that b and area could also be written:
b = @(t) polyval([8.89e-5, -4.57e-3, 2.27e-1, -9.52e-3], t);
area = @(y) polyval([1.6e-3, -2.76e-2, 1.4e-1, -1.1e-1, 0.287], y) * 1e6;

Plus de réponses (0)

Catégories

En savoir plus sur Data Type Identification 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!

Translated by