![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/196853/image.png)
Getting an error "INDEX OUT OF BOUNDS" in my matlab program. Please help.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Virajan Verma
il 2 Ott 2018
Modificato: KALYAN ACHARJYA
il 2 Ott 2018
%%Loop for chi values for icounter=-1:1:1 chi=(icounter); end
%%Shape function for axial effect N1(chi)=(-1/2)*chi*(1-chi); N2(chi)=(1+chi)*(1-chi); N3(chi)=(1/2)*chi*(1+chi);
%%First Derivatives of Shape Function N1=diff(N1(chi),chi); N2=diff(N2(chi),chi); N3=diff(N3(chi),chi);
%%%%Second Derivatives of Shape Function N11=diff(N1(chi),chi,2); Attempted to access N1(1); index out of bounds because numel(N1)=0.(ERROR) N22=diff(N2(chi),chi,2); N33=diff(N3(chi),chi,2);
0 Commenti
Risposta accettata
KALYAN ACHARJYA
il 2 Ott 2018
Modificato: KALYAN ACHARJYA
il 2 Ott 2018
This loop loop
for icounter=-1:1:1
chi=(icounter);
end
chi=1
and When you calculate the following diff
N1(chi)=(-1/2)*chi*(1-chi);
N2(chi)=(1+chi)*(1-chi);
1-chi terms lead to zero, so N1(chi) is null and you try to diff N1(chi) (Null) with respect to 1.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/196853/image.png)
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!