Index in position 2 exceeds array bounds
Show older comments
Hi, I have this script
%%
% DEFINIZIONE PARAMETRI DINAMICI
%DEFINIZIONE vettore frequenze
F_plot=400; %Frequenza limite dell'analisi
df=0.1;
f=[0:df:F_plot];
w=2*pi*f;
%%
% COSTRUZIONE SS
csi=0.0024; % smorzamento percentuale -- 0.05 è il valore nella flexsspf
FREQ_equi=load(['freq_prop.txt']);
pfdx_equi=load(['pffe.txt']);
%modi=[1:length(FREQ_equi)]';
%gamma_equi=pfdx_equi(:,2); % matrice dei fattori di partecipazione modale
save('PF1_equi.dat','pfdx_equi', '-ascii') % | modo | PF1 | PF2 | ... | PFr |
save('FREQ1_equi.dat','FREQ_equi', '-ascii') % | modo | freq
type=1; % 1 se spostamento ( q ), 2 se accelerazione ( q** )
[Aq,Bq,Cq,Dq]=flexsspf('','PF1_equi.dat','freq_prop.txt',csi,type);
sysansq_equi=ss(Aq,Bq,Cq,Dq);
%%
% vado a plottare il modulo della funzione di risposta in frequenza
[mags,phases]=bode(sysansq_equi,w);
[output,input,frequencies]=size(mags);
figure (1)
semilogy(f,squeeze(mags(:,1,:)),'linewidth',1)
hold on
grid on
title('Mag FRFs uscite/ingressi')
xlabel('Frequency [Hz]')
ylabel('Mag FRF [Disp Unit/Force Unit]')
legend('q1','q2','q3','q4','q5','q6','q7','q8','q9','q10');
and this error is occurred
In untitled34 (line 43)
Index in position 2 exceeds array bounds.
Error in untitled34 (line 56)
semilogy(f,squeeze(mags(:,1,:)),'linewidth',1)
Can i solve this problem?
6 Comments
Walter Roberson
on 2 Aug 2022
check if mags is empty
Federico Paolucci
on 2 Aug 2022
Walter Roberson
on 2 Aug 2022
yes that is empty.
Walter Roberson
on 2 Aug 2022
is your flexsspf still the code from https://www.mathworks.com/matlabcentral/answers/1769315-the-a-and-b-matrices-must-have-the-same-number-of-rows ? that code ignores several of its inputs
Federico Paolucci
on 2 Aug 2022
Walter Roberson
on 2 Aug 2022
please show the new code
Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!