MATLAB >> linear spline - 1st order

by nhum » Fri, 07 May 2004 02:07:04 GMT


I am using the spline command to fit some data. However, I would like
to know if I can specify the order of the polynomial function of each

I want to use only the 1st order, i.e. linear spline.

now i used

model = spline( ytraX, xtraX );

but how i can specify the order to be 1.


Similar Threads

1. System of coupled non-linear 1st order ODEs - MATLAB

2. Non-linear 1st order ODE

Dear Matlab users,

Does anyone know how to solve the following ODE numerically in Matlab?

u(x)*(du/dx) = -p(x) -D*u(x)^2

with the boundary condition


and p(x) known.

I have tried bvp4c, but without success. I don't know what to do with 
the u(x)*(du/dx) term. One can solve the equation analytically but I 
must solve some parts numerically anyway, so I thought I could solve the 
whole thing numerically.


Daniel Soderstrom

3. Problem: to find 1st and 2nd derivatives of a circular spline - MATLAB

4. solve nonlinear diff equation 1st order

I would plot this nonlinear differential equation :

RC * dy/dt + y(t) = x(t);
x(t) = sin(wt);

If I consider R=cste there is non problem and I can plot the
solution quickly but in reality I would have :

R = 1 / ( x(t) * ( 1-exp( -sqrt(x(t)) ) ) / sqrt(x(t) )

Matlab can't solve it, it run and never finish the calcul.
Even if I use a simple form for R=1/(x(t) * 0.9);
Someone could tell me how to solve this equation ?

PS : this is what I've done :
I've use the ode45 solver

%In Matlab
tspan = [1e-9 1e-6];
y0 = 0;
[t, y] = ode45('dydt',tspan,y0);
plot(t, y);

%%% The function I've define in a dydt.m file
function dydt = dydt(t, y)
x = sin(wt);
C = 10e-15;
R = 1 / (0.9*x(t));
dydt = 1/(R*C) * (x - y);
%end of function

5. 1st order PDE system with pdepe?? - MATLAB

6. Is 1st order PDE solvable with PDE Toolbox?

Hello all,

In the documentation of the Matlab PDE Toolbox, the problems that can
be solved by using PDE are described as 2nd order PDE problems, i.e.
elliptic parabolic problems.

I have a 1st order PDE problem with one spatial dimension and time
variable. Can I solve that problem with PDE toolbox as well.

Specifically my problem is solving the equations of unsteady flow of
a gas inside a tube. Therefore, I also have two time and distance
dependent temperatures, namely gas temperature and wall temperature.

Thanks in advance


7. 1st order DE with Boundary values - MATLAB

8. Fitting a closed cubic spline to a set of ordered points

I have a set of points (x_1,y_1),(x_2,y_2)...(x_n,y_n)
I am trying to find a "cubic spline" 'interpolating' (passing thru)
these points. It should start from the first point and stop at the
last point.

Is there a fast way to do this in matlab?  I looked at the
spline toolbox but most examples there are for
single valued functions.