Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
adding a curve

Subject: adding a curve

From: Teddy

Date: 29 Jun, 2009 23:28:01

Message: 1 of 3

I have this plot with 1x160 row vector for x and 1x160 row vector for y.

My curve starts from x=0 and ends at x=2.5 but I want to add a curve that fits my original curve and want to make it go all the way to x=3.5 but I am not sure how. (I thought about adding more components for x and y but I dont think this will give accurate curve)


Is there any easier way of doing this?

Subject: adding a curve

From: ImageAnalyst

Date: 30 Jun, 2009 00:34:54

Message: 2 of 3

On Jun 29, 7:28 pm, Teddy <skim...@ec.auckland.ac.nz> wrote:
> I have this plot with 1x160 row vector for x and 1x160 row vector for y.
>
> My curve starts from x=0 and ends at x=2.5 but I want to add a curve that fits my original curve and want to make it go all the way to x=3.5 but I am not sure how. (I thought about adding more components for x and y but I dont think this will give accurate curve)
>
> Is there any easier way of doing this?

------------------------------------------------------------------------------------
Since you don't have ANY data outside of your 0-2.5 range (let alone
"accurate" data) you'll need to pick a model, fit it to the data
inside the range that you DO have, and then extrapolate the "missing"
range. One way you can to this is to use polyfit(), passing in 0-2.5
and then use polyval() passing in the range 0-3.5. It will give you
fitted values in the range 0-2.5 and then in the range 2.5 - 3.5 it
will give you values of that same model but extrapolated out into that
range. Will this work for you?

Subject: adding a curve

From: John D'Errico

Date: 30 Jun, 2009 03:37:01

Message: 3 of 3

Teddy <skim178@ec.auckland.ac.nz> wrote in message <19843666.48517.1246318111638.JavaMail.jakarta@nitrogen.mathforum.org>...
> I have this plot with 1x160 row vector for x and 1x160 row vector for y.
>
> My curve starts from x=0 and ends at x=2.5 but I want to add a curve that fits my original curve and want to make it go all the way to x=3.5 but I am not sure how. (I thought about adding more components for x and y but I dont think this will give accurate curve)
>
>
> Is there any easier way of doing this?

I'll suggest that this is a good application for my SLM
tools. You have some data, but you need to extrapolate
it out a ways. A polynomial model is generally terribly
poor for this. On the other hand, if you can supply
some intelligent information on what you expect the
curve to do in extrapolation, then slmengine will be
able to extend the curve intelligently. For example, you
may be wiling to assume that the curve is monotone,
or you may know something about the curvature.

Download the slm tools here:

http://www.mathworks.com/matlabcentral/fileexchange/24443

This does require the optimization toolbox.

John

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us