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 CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by