Matrix dimensions must agree ERROR WITH MY CODE.Can anyone suggest a solution to this problem in my code below

2 ビュー (過去 30 日間)
x1 = [x_m';zeros(t_o,1)];
x2 = [zeros(t_o,1);x_m';zeros(t_o,1)];
x3 = [zeros(2*t_o,1);x_m';zeros(t_o,1)];
x4 = [zeros(3*t_o,1);x_m';zeros(2*t_o,1)];
x5 = [zeros(4*t_o,1); x_m'];
y_m = x1+x2+x3+x4+x5;% Simulated Measurement
y_m=y_m';

回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 6 月 25 日
Suppose the number of rows in x_m' is M. Then x1 has M+t_o rows, x2 has t_o+M+t_o = M+2*t_o rows, x3 has 2*t_o+M+t_o = M+3*t_o rows, x4 has 3*t_o+M+2*t_o = M+5*t_o rows, x5 has 4*t_o+M = M + 4*t_o rows.
And then you try to add these items, each of which has a different number of rows (except in the case where t_o is zero). You cannot add when the number of rows or columns or pages is different.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by