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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

For loop outputs 1x1 vectors into a matrix instead of scalars

CE_10614767
2-Explorer

For loop outputs 1x1 vectors into a matrix instead of scalars

I am analyzing a ground motion applied to a SDOF structure and finding the motion with Newmark's method. 

To accomplish this I have read the ground motion in with the readexcel function and then use a for loop to find the relative displacement, acceleration and velocity for each time step.

 

The file used and the needed excel file are attached.

 

 

 

 

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:CE_10614767)

In the calculation of p.hat you typed square brackets! Never do this unless you want to create a matrix/vector. Always use (round) parentheses to group expressions.

Werner_E_0-1678300492162.png

 

View solution in original post

2 REPLIES 2
Werner_E
25-Diamond I
(To:CE_10614767)

In the calculation of p.hat you typed square brackets! Never do this unless you want to create a matrix/vector. Always use (round) parentheses to group expressions.

Werner_E_0-1678300492162.png

 

LucMeekes
23-Emerald III
(To:CE_10614767)

You've typed square brackets [ ] in your expression for Phat:

LucMeekes_1-1678300989030.png

You should NEVER type square brackets, unless you want to create an array.

Change those square brackets to (ordinary) round brackets.

LucMeekes_2-1678301085759.png

Prime will/may show square brackets if necessary (in this  particular case it will not), but that doesn't matter.

 

Success!
Luc

Announcements

Top Tags