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: Floating Point Errors

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-02-2011
12:27 AM

05-02-2011
12:27 AM

Hey everyone,

I've been working on a Mathcad worksheet that is supposed to generate the response spectra for earthquake data using a function, but whenever I use a value that is too small for my Dt value, highlighted in the worksheet, I get the message that there is a floating point error. The smallest value I seem to be able to get away with is 0.02, but the problem is I need to be able to use a smaller value so that I can get more accurate output. Does anyone know how to fix this problem, or at the very least what it means?

Thanks,

Talina

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

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

05-02-2011
06:29 AM

05-02-2011
06:29 AM

Can't say I totally understand what's going on here, but you seem to be trying to fit a higher frequency than (half) the sampling frequency, hence violating the Nyquist criterion. The SDOF function is generating extremely large numbers (too large for Mathcad to cope with for some timestep sizes, hence the floating-point error message). Perhaps its algorithm isn't valid for such conditions. I'll leave it to others more knowledgeable in this area to confirm or otherwise.

Alan

8 REPLIES 8

Highlighted
##

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

05-02-2011
04:20 AM

05-02-2011
04:20 AM

Re: Floating Point Errors

Could you please post the data in Mathcad format? Not all of us have Matlab so can't import the data.

Stuart

Highlighted
##

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

05-02-2011
05:16 AM

05-02-2011
05:16 AM

Re: Floating Point Errors

Here's the file with the reshaped data entered directly as a Mathcad table. Haven't spent any time investigating the problem yet.

Alan

Highlighted

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

05-02-2011
06:29 AM

05-02-2011
06:29 AM

Can't say I totally understand what's going on here, but you seem to be trying to fit a higher frequency than (half) the sampling frequency, hence violating the Nyquist criterion. The SDOF function is generating extremely large numbers (too large for Mathcad to cope with for some timestep sizes, hence the floating-point error message). Perhaps its algorithm isn't valid for such conditions. I'll leave it to others more knowledgeable in this area to confirm or otherwise.

Alan

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

05-02-2011
08:35 AM

05-02-2011
08:35 AM

Re: Floating Point Errors

The smallest value I seem to be able to get away with is 0.02, but the problem is I need to be able to use a smaller value so that I can get more accurate output.

Why? The question specifically says "using periods and time-steps that are integer multiples of 0.02 seconds".

Either you made a mistake in the implementation, or Newmark's method is not valid for time steps that are smaller than the data sampling interval. As an example, try a time step of 0.019. The numbers just blow up.

I'l also note that the result for a time step of 0.02 is very different to the results for time steps of 0.04 or 0.06. Is that expected?

Highlighted
##

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

05-02-2011
12:37 PM

05-02-2011
12:37 PM

Re: Floating Point Errors

In the SDOF program, in the calculation for (a) you have (Delta t), but it should be (Delta tec), thats why the period was screwing up the works.

If you want to vary the time step of the ground acceleration record, i.e. using data points that are multiples of the original time step, one way is to use the linterp function to make the record a function of time, then you can use whatever time step you want, including non integer multiples of the time step.

Wayne

Highlighted
##

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

05-03-2011
03:42 AM

05-03-2011
03:42 AM

Re: Floating Point Errors

Wow, thanks everyone for your help. I unfortunately am still having issues getting the function to work. I changed my Dt value to Dtec per Wayne's advice, but I'm still getting the message that there is a floating point error.

Thanks again to everyone who's helped so far. I really do appreciate it.

Highlighted
##

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

05-03-2011
08:55 AM

05-03-2011
08:55 AM

Re: Floating Point Errors

A good catch by Wayne!

I changed my Dt value to Dtec per Wayne's advice, but I'm still getting the message that there is a floating point error.

It works for me

Highlighted
##

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

05-08-2011
02:57 AM

05-08-2011
02:57 AM

Re: Floating Point Errors

Funny, after I used the data from the table instead of the Matlab output, it worked too. Thanks again to everyone who helped me. I really appreciate the time you took.