cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

Highlighted
Newbie

## 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

14 REPLIES 14
Highlighted

## 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

## Re: Help with Linterp plotting please

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

Mike

Highlighted

## 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

## 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

## 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

## Re: Help with Linterp plotting please

You could try just a simple piecewise function.

Highlighted

## 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

## Re: Help with Linterp plotting please

Hi,

many thanks for that, seems to work.

Omar

Highlighted

## 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

## 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

## 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

## 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

## 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

## 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

Announcements