help-octave
[Top][All Lists]
 Thanks doug, you are right, This is solve my problem Gönderen: Doug Stewart Gönderildi: 9 Temmuz 2019 Salı 18:28 Kime: Aziz YÜCELEN Bilgi: address@hidden Konu: Re: About Array Element Division Problem in Loop   On Tue, Jul 9, 2019 at 10:46 AM Aziz YÜCELEN wrote: Hi, I m newbee and i have a problem about array element division in loop.Can you help me please? Here my code Get_N_value = input('Enter N value: '); Get_alpha_count =(2*Get_N_value)-4; Get_beta_count =(Get_N_value-1); b_count =(Get_N_value-2); s_count =b_count; for gac=1:Get_alpha_count   sprintf('Enter alpha  %d th value:', gac)   alpha_value(1,gac) = input('',gac); try alpha_value(1,gac) = input('') what your are getting is chars not doubles.   end for gbc=1:Get_beta_count   sprintf('Enter beta %d th value:', gbc)   beta_value(1,gbc) = input('',gbc); end for i_index=1:b_count m=(beta_value(i_index)-beta_value(i_index+1))/beta_value(i_index) end and result: Enter N value: 5 ans = Enter alpha  1 th value: 2 ans = Enter alpha  2 th value: 0 ans = Enter alpha  3 th value: 2 ans = Enter alpha  4 th value: 2 ans = Enter alpha  5 th value: 1 ans = Enter alpha  6 th value: 3 ans = Enter beta 1 th value: 2 ans = Enter beta 2 th value: 2 ans = Enter beta 3 th value: 4 ans = Enter beta 4 th value: 4 m = 0 m = -0.040000 <---- this is actually -2/2 = -1 but octave find -0.04000 m = 0 -- DAS 