Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

trying to right code to generate matrix for three different frequency

Asked by Aniket on 6 May 2013

Hello I have 3 frequencies w1 = 100 , w2 = 200 and w3 = 400

and I have state space model matrix

Ai = [0 1;-wi 0]

Bi = [0 wi]

ci = [1 0]

I want to generate these matrix for each frequencies i mentioned above and pack them in 1 final matrix respectively A, B and C

how should i do this ?

i have tried but its not working

w = [100 200 300]

for i = 1:3

    A(i)=[0 1; w(i) 0]
    B(i)=[0 w(i)]

end

any other suggestion or ways ?

0 Comments

Aniket

Products

No products are associated with this question.

1 Answer

Answer by John Doe on 6 May 2013
Edited by John Doe on 6 May 2013
Accepted answer
w = [100 200 400];
A = zeros(2,2,3);
B = zeros(1,2,3);
C = zeros(1,2,3);
for i = 1:3
  A(:,:,i) = [0 1; -w(i) 0];
  B(:,:,i) = [0 w(i)];
  C(:,:,i) = [1 0];
end

Hope this was what you're looking for.

1 Comment

Aniket on 6 May 2013

Thank you

John Doe

Contact us