Clear Filters
Clear Filters

ERROR ... ----------​----------​----------​-------- cwt ---> Invalid Value for Scales !

2 views (last 30 days)
zl
zl on 9 May 2022
Commented: zl on 11 May 2022
what is the reason for this error?
  11 Comments
zl
zl on 10 May 2022
Thank you for your patient reply, this is the code I used, you can check it

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 10 May 2022
Compare the example_ground_motion.acc file with the ex1.acc and ex2.acc files. The example_ground_motion.acc file starts with
PEER NGA Rotated Accelerogram (v1.1)
H1 for rotation: SAN FERNANDO 02/09/71 14:00, PACOIMA DAM, 254 (CDMG STATION 279)
H2 for rotation: SAN FERNANDO 02/09/71 14:00, PACOIMA DAM, 164 (CDMG STATION 279)
rotation angle - clockwise 31.0
FN component, azimuth = 195.0
Acceleration in g
4164 0.01000 NPTS, DT
and then there are 5 columns of data (but the last row in the file does not have all 5 entries.)
The ex1.acc and ex2.acc files just start directly in to data, after a one-line header, such as
0.01 22600
-0.016
-0.055
-0.070
The code you are using, main_analyze_ground_motion.m expects that multi-line header, and does some fixed-format reading of the file in places, in order to extract dt (the timestep). When with the data in the file not being in the expected form, sometimes at the point it does the reading of dt, the next available data in the file just happens to be a valid floating point number less than 1. That is the case for ex1.acc : even though the data is not in the expected format, it just happens to read in 0.0153 for the time step, and that value does not happen to lead to a code crash.
But for ex2.acc, after doing the fixed-format reading, the file just happens to be positioned after the decimal point of a number, and it ends up reading 0.517 without the leading 0.5 so it is parsing 17 and reads that as 17. That happens to crash the program as the code needs a value less than about 0.178 in order for a vector needed by cwt to happen to start with a value greater than 0.
The solution is to only use .acc files that have the expected file header... or to use some other code to read the .acc files.
  1 Comment
zl
zl on 11 May 2022
This problem has been solved. Thank you very much for your patient reply and answer. Thank you very much indeed@Walter Roberson

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!