Looks a bit strange to me : in loop n=1:3, t(1) is defined three
times (may be OK)
but schritte could be non integer so a bit odd for an index into an array.
Is the t() array being grown (size not previously defined)?
Mike.
On 06/06/2017 08:27, Sachverständigenbüro Niedermaier Holger wrote:
Dear all,
may anybody be able to explain why I get the error message "invalid
index in line 12“ by running the following function?
function [Wert]=Berechnungsfunktion(von,bis,schrittweite,y0,y2,t0,t2)
for n=1:3
t(1)=t0;
y(1,n)=y0;
schritte=(bis-von)/schrittweite;
for i=1:schritte
t(i+1)=t(i)+schrittweite;
y(i+1,n)=10^(log10(y0*Faktor(n))+log10(y2/y0)/log10(t2/t0)*log10(t(i+1)/t0))
end
disp(n)
for i=1:schritte
Energie(n)=Energie(n)+y(i)*y(i)*schrittweite*10^(-3);
end
disp(Energie(n))
end
//disp("1 Polig",Energie(3),"2 Polig", Energie(1),"3 Polig", Energie(2))
//Wert=[Energie];
endfunction
I myself be to blind to find my mistake
Thanks a lot
Holger
_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users
--
Dr.M.J.McCann,MJMcCann-Consulting
_______________________________________________
users mailing list
[email protected]
http://lists.scilab.org/mailman/listinfo/users