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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Floating Point Errors

atbarajas
1-Newbie

Floating Point Errors

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

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

8 REPLIES 8
StuartBruff
23-Emerald II
(To:atbarajas)

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

Stuart

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

Alan

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

RichardJ
19-Tanzanite
(To:atbarajas)

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?

wayne
3-Visitor
(To:atbarajas)

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

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.

RichardJ
19-Tanzanite
(To:atbarajas)

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

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.

Top Tags