From: Abdullah on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <beef747b-b09f-40dd-90c5-bf17a7dd5055(a)s3g2000yqs.googlegroups.com>...
> OK, like I thought. So how did interp1 work for you? Where's your
> code? Any error message? You need to put some work into this because
> I'm taking off for the night. If I remember, I'll look at your code
> tomorrow.


I have the array saved in ref
t=0:0.01:1.5
i=0:0.01:3
newarr=interp1(t, ref, i);

it didn't work.
From: Nathan on
On Jan 6, 10:03 pm, "Abdullah " <abdullahu...(a)yahoo.com> wrote:
> ImageAnalyst <imageanal...(a)mailinator.com> wrote in message <beef747b-b09f-40dd-90c5-bf17a7dd5...(a)s3g2000yqs.googlegroups.com>...
> > OK, like I thought.  So how did interp1 work for you?  Where's your
> > code?  Any error message?  You need to put some work into this because
> > I'm taking off for the night. If I remember, I'll look at your code
> > tomorrow.
>
> I have the array saved in ref
> t=0:0.01:1.5
> i=0:0.01:3
> newarr=interp1(t, ref, i);
>
> it didn't work.

Saying "It didn't work" doesn't help anybody. You need to say WHY it
didn't work. Were there any error messages? If not, WHAT didn't work?
What result did you get? Why was it not what you expected?

Did you read the help?

"yi = interp1(x,Y,xi) interpolates to find yi, the values of the
underlying function Y at the points in the vector or array xi. x must
be a vector. Y can be a scalar, a vector, or an array of any
dimension, subject to the following conditions:
*
If Y is a vector, it must have the same length as x. A scalar
value for Y is expanded to have the same length as x. xi can be a
scalar, a vector, or a multidimensional array, and yi has the same
size as xi.
*
If Y is an array that is not a vector, the size of Y must have
the form [n,d1,d2,...,dk], where n is the length of x. The
interpolation is performed for each d1-by-d2-by-...-dk value in Y. The
sizes of xi and yi are related as follows:
o
If xi is a scalar or vector, size(yi) equals [length(xi),
d1, d2, ..., dk].
o
If xi is an array of size [m1,m2,...,mj], yi has size
[m1,m2,...,mj,d1,d2,...,dk]."


Good night

-Nathan
From: Abdullah on
Nathan <ngreco32(a)gmail.com> wrote in message <af0e11be-73f1-4435-a142-d549389ba37a(a)f5g2000yqh.googlegroups.com>...
> On Jan 6, 10:03 pm, "Abdullah " <abdullahu...(a)yahoo.com> wrote:
> > ImageAnalyst <imageanal...(a)mailinator.com> wrote in message <beef747b-b09f-40dd-90c5-bf17a7dd5...(a)s3g2000yqs.googlegroups.com>...
> > > OK, like I thought.  So how did interp1 work for you?  Where's your
> > > code?  Any error message?  You need to put some work into this because
> > > I'm taking off for the night. If I remember, I'll look at your code
> > > tomorrow.
> >
> > I have the array saved in ref
> > t=0:0.01:1.5
> > i=0:0.01:3
> > newarr=interp1(t, ref, i);
> >
> > it didn't work.
>
> Saying "It didn't work" doesn't help anybody. You need to say WHY it
> didn't work. Were there any error messages? If not, WHAT didn't work?
> What result did you get? Why was it not what you expected?
>
> Did you read the help?
>
> "yi = interp1(x,Y,xi) interpolates to find yi, the values of the
> underlying function Y at the points in the vector or array xi. x must
> be a vector. Y can be a scalar, a vector, or an array of any
> dimension, subject to the following conditions:
> *
> If Y is a vector, it must have the same length as x. A scalar
> value for Y is expanded to have the same length as x. xi can be a
> scalar, a vector, or a multidimensional array, and yi has the same
> size as xi.
> *
> If Y is an array that is not a vector, the size of Y must have
> the form [n,d1,d2,...,dk], where n is the length of x. The
> interpolation is performed for each d1-by-d2-by-...-dk value in Y. The
> sizes of xi and yi are related as follows:
> o
> If xi is a scalar or vector, size(yi) equals [length(xi),
> d1, d2, ..., dk].
> o
> If xi is an array of size [m1,m2,...,mj], yi has size
> [m1,m2,...,mj,d1,d2,...,dk]."
>
>
> Good night
>
> -Nathan

Its morning here. Thanks for your reply.

I was using interp1 wrong but i corrected it then. interp1 is for interpolation. Predicting unknown values from known values. It just changes the sampling rate. I don't want to do that.
I have a two column array of trajectory. 1st column contains time
t=0:0.01:1.5;
arr=[t trajectory];
trajectory is in degrees. It starts from 90 deg, goes to 70 deg in 0.2 sec and from 70 deg to 180 in 1.3 sec making a smooth curve. The whole trajectory is 1.5 sec.
The new trajectory must be from 90-70 deg in 0.4 sec and from 70-180 degrees for the rest of the time.

t1=0:0.01:3;
arr=[t1 new_trajectory];

what should I do with trajectory to get new_trajectory??
new_trajectory= ????

Thanks.
From: Jan Simon on
Dear Abdullah!

> I was using interp1 wrong but i corrected it then. interp1 is for interpolation. Predicting unknown values from known values. It just changes the sampling rate. I don't want to do that.

The problem is getting less clear to me again.
You do *not* change the sampling rate but want the same curve with a different number of time ticks?!
Do you want to apply 2 different changes of the sampling rate for the 2 different parts of the curve?
Do you want to use INTERP1 to determine the new time points?

Perhaps you can create some short example values with about 10 time points?

Kind regards, Jan
From: Abdullah on
"Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <hi46qp$pre$1(a)fred.mathworks.com>...
> Dear Abdullah!
>
> > I was using interp1 wrong but i corrected it then. interp1 is for interpolation. Predicting unknown values from known values. It just changes the sampling rate. I don't want to do that.
>
> The problem is getting less clear to me again.
> You do *not* change the sampling rate but want the same curve with a different number of time ticks?!
> Do you want to apply 2 different changes of the sampling rate for the 2 different parts of the curve?
> Do you want to use INTERP1 to determine the new time points?
>
> Perhaps you can create some short example values with about 10 time points?
>
> Kind regards, Jan

Hi, Thanks for your kind reply.

Yes I don't want to change the sampling rate. I want to scale the array in time. Total array is 1.5 sec with time step of 0.01. I want to change it to 3 sec with the same time step.