フィルターのクリア

How to get values out of a matrix equation, when one of its elements is an array?

1 回表示 (過去 30 日間)
Zeyad Elsayed
Zeyad Elsayed 2019 年 6 月 1 日
コメント済み: Zeyad Elsayed 2019 年 6 月 5 日
Hello everyone,
My question is how can I solve a matrix equation, when one of its elements is an array?
This error comes up in the command window preventing 'q' to be found. "Dimensions of arrays being concatenated are not consistent."
% Stating variables
omega = 100
M_22 = (0:0.1:20);
C_22 = (0:0.2:40);
F_1 = (0:0.4:80);
% Creating Matrix
M = [1 0; 0 M_22];
C = [1 2; -2 C_22];
K = [100 0; 0 100];
F = [F_1; F_2];
% Equations
Z = -(omega^2)*M + omega*j*C + K;
Z_inverse = inv(Z);
q = Z_inverse*F;
Thanks in advance!
  4 件のコメント
Walter Roberson
Walter Roberson 2019 年 6 月 4 日
tvals = 0:0.1:20;
numt = length(tvals);
v3 = zeros(2, numt);
for tidx = 1 : numt
t = tvals(tidx);
....
v3(:, tidx) = q;
end
Zeyad Elsayed
Zeyad Elsayed 2019 年 6 月 5 日
Perfect it worked! Thanks Walter, I want to Accept your answer but for some reason I cant find how to do this. Probably because its submitted as a comment.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by