Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Re: Help with Linterp plotting please

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
07:53 AM

05-04-2011
07:53 AM

Re: Help with Linterp plotting please

Hi

Attached are two plots, **A. **which uses points that allow me to plot a triangular shaped curve using the linterp function and **B.** which uses points that won't let me plot as the error states vectors must be in assending order.

**For B**. how can I plot this rectangular shaped curve using Linterp function? Ultimately I wish to obtain a plot and a function (with respect to t as in plot **A.**) for the curve

Thanks

Omar

Labels:

14 REPLIES 14

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
08:16 AM

05-04-2011
08:16 AM

Re: Help with Linterp plotting please

Firstly have a look at the attached sheet. A much cleaner way of setting up your worksheet, well in my opinion anyway.

In your evaluation of Pt2 you have tbd in there twice, Linterp calculates the slope and intercept of the line that passes through each pair of points. If the x-values of two points are the same then the slope is infinite.

Mike

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
08:19 AM

05-04-2011
08:19 AM

Re: Help with Linterp plotting please

If you slightly increase the second value of t.bd you get the following result.

Mike

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
08:56 AM

05-04-2011
08:56 AM

Re: Help with Linterp plotting please

Thanks for that.

Is there another function other than linterp that i can use to plot the same thing?

Omar

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
09:16 AM

05-04-2011
09:16 AM

Re: Help with Linterp plotting please

If all you want is a plot, just plot column 1 vs column 2.

It is not possible to turn your data into a function, because at the point tdb the function would be undefined. So if you want something other than just a plot, you will have to explain what you are trying to achieve.

I note you mention "time steps". If this is supposed to represent something real than you cannot have a perfect step function of time. Nothing happens instantly.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
09:29 AM

05-04-2011
09:29 AM

Re: Help with Linterp plotting please

I'd like to use the function from the curve plot as part of a differential equation (equation of motion) that I will solve using runge kutta.The reason for turning the data into a function is to use this function as an input to a differential equation which i can then solve using the built in fourth order Runge Kutta function.

The plot is basically a force time history (acting on a structural member) and the differential equation is the equation of motion used to determine a deflection time history of the structural member.

So ideally obtaining a function would be usefull, any thoughts?

Omar

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
09:57 AM

05-04-2011
09:57 AM

Re: Help with Linterp plotting please

You could try just a simple piecewise function.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
09:57 AM

05-04-2011
09:57 AM

Re: Help with Linterp plotting please

Attached is another method, using a simple program to define the force input, it takes a little more time, but doesn't suffer the vertical line problem.

I assume you want a numerical solution since you have a time step and both metods will work for that, But if you want symbolically, do in do in two steps, less than tbd and greater than tb.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
10:56 AM

05-04-2011
10:56 AM

Re: Help with Linterp plotting please

Hi,

many thanks for that, seems to work.

Omar

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
02:03 PM

05-04-2011
02:03 PM

Re: Help with Linterp plotting please

Nice Wayne,

Got to say though making everything a function of t is horrible. Creating a vector of values is a much neater way.

Mike

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
02:17 PM

05-04-2011
02:17 PM

Re: Help with Linterp plotting please

Got to say though making everything a function of t is horrible. Creating a vector of values is a much neater way.

I disagree. Once you have a function you can do anything, including create a vector of values. The reverse is not true.

Functions are very functional

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
03:20 PM

05-04-2011
03:20 PM

Re: Help with Linterp plotting please

I disagree. Once you have a function you can do anything, including create a vector of values. The reverse is not true.

Yes that is true. It's when a lot of functions become dependant on a single variable I think it looks untidy.

Functions are very functional

That is terrible.

Mike

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
02:08 PM

05-04-2011
02:08 PM

Re: Help with Linterp plotting please

Just to be pedantic and optimize it a little further, we can get rid of the If statement.

Mike

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
02:48 PM

05-04-2011
02:48 PM

Re: Help with Linterp plotting please

Yes I agree with Richard, functions are very functional, but, wait, functionals are functions of functions, which sounds like a closed loop which is not a function but an equation, so functions are very equational?

Any way, what he is really after is a function of time, not the graph.

I always forget about using the boolean function that way, thanks.

But I get confused quickly, so I generally don't use any way, at least not until everything is working.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

05-04-2011
03:23 PM

05-04-2011
03:23 PM

Re: Help with Linterp plotting please

Yes I agree with Richard, functions are very functional, but, wait, functionals are functions of functions, which sounds like a closed loop which is not a function but an equation, so functions are very equational?

Confused......

I always forget about using the boolean function that way, thanks. But I get confused quickly, so I generally don't use any way, at least not until everything is working.

I'm the same, and your example was working. Didn't want to be left out of producing something useful

Mike