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

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

CE_10614767
1-Newbie

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.

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

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

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

Top Tags