Index in position 2 exceeds array bounds

조회 수: 2 (최근 30일)
Federico Paolucci
Federico Paolucci 2022년 8월 2일
댓글: Walter Roberson 2022년 8월 2일
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
Federico Paolucci
Federico Paolucci 2022년 8월 2일
More or less it is the same, the only differences are these: in flexsspf I inserted the frequency file as .txt instead of .dat, because otherwise it didn't work. Then I removed the number of modes from the input files and then commented "modi" because I don't need it. The fact is that the flexsspf function should work even without the first input which is empty in the script, because in theory only frequencies and pf (participation factors) should suffice
Walter Roberson
Walter Roberson 2022년 8월 2일
please show the new code

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by