How can ı solve this error ??Unable to perform assignment because the size of the left side is 1-by-5 and the size of the right side is 26-by-1.
1 次查看(过去 30 天)
显示 更早的评论
% Constants
N = 100; % Number of parameter values
q1_range = linspace(0, 100, N);
q2 = 100;
q3 = 0;
q4 = 0;
% Initialize arrays to store pole data
poles_real = zeros(N, 5);
poles_imag = zeros(N, 5);
% Compute poles for each parameter value
for i = 1:N
q1 = q1_range(i);
polynomial = [1, q1, (289/11), (173*q1/14), q4, (2628/11), (2091*q1/19), q3, (63*q4/25), (10026/11), (6193*q1/8), q2, 5938, 3, 37945, 9, 93795, 1464591, 542, 793, 1994, 7, 6, 10, 15, 8143, 3];
roots_poly = roots(polynomial);
poles_real(i, :) = real(roots_poly);
poles_imag(i, :) = imag(roots_poly);
end
% Plot pole-spread
figure;
plot(poles_real, poles_imag, 'x');
xlabel('Real Part');
ylabel('Imaginary Part');
title('Pole-Spread of the Polynomial');
legend('Pole 1', 'Pole 2', 'Pole 3', 'Pole 4', 'Pole 5');
grid on;
0 个评论
回答(1 个)
James Tursa
2023-5-23
编辑:James Tursa
2023-5-23
You could expand the size of the LHS array. E.g.,
poles_real(i, 1:numel(roots_poly)) = real(roots_poly);
poles_imag(i, 1:numel(roots_poly)) = imag(roots_poly);
Whether these 26 roots is really what you wanted is another question ...
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Pole and Zero Locations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!