how to loop the following?
Infos
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Afficher commentaires plus anciens
Okay I updated it with the photo of what I'm trying. Anyway help will be appreciated.
I'm trying to find force=mass*acceleration
mass is a 20 by 20 matrix
acceleration is a 20 by 1 column vector in the form [0,0,0,Xn,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]'
where Xn is a 1 by 2211 row vector.
Basically I'll be splitting the acceleration Xn term into its components and then add them up using the superposition theory.
I hope the photo helps clear things up.

Réponses (1)
Image Analyst
le 11 Fév 2017
I believe this will do the strange thing you want to do:
x = randi(9, 1, 2211); % Whatever...
mass = ones(20);
accel = ones(size(mass, 1), 1);
accel(2) = sum(x, 2)
force = mass * accel
2 commentaires
ramlal
le 11 Fév 2017
Image Analyst
le 11 Fév 2017
I'm seeing your photo, where you showed various x elements but always in the second row, not in "the 4 spot" (meaning the 4th row I guess). If you want it in the 4th row instead, just do this:
accel(4) = sum(x, 2)
Cette question est clôturée.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!