MATLAB Answers

fzero Index exceeds matrix dimensions, image processing

1 view (last 30 days)
Diego Díaz-Barriga
Diego Díaz-Barriga on 11 Jun 2016
Answered: Ian Hunter on 20 Feb 2019
hi everybody, im processing satelite imagenary, the last step in the process is a nonlinear ecuation so I'm using Fzero but it continues telling me that index exceeds matrix dimensions here is my script.
%%%%cargar imagenes%%%%
IM(:,:,2)=double(geotiffread('LC80280452015160LGN00_B2.TIF'));
RED(:,:,4)=double(geotiffread('LC80280452015160LGN00_B4.TIF'));
%%%%%TOA%%%%%%
%Banda Azul=2
A(:,:,2)=IM(:,:,2)*0.00002;
A1(:,:,2)=A(:,:,2)+0.1;
Atoa(:,:,2)=A1(:,:,2)/0.9279549148;
%banda Roja=4
R(:,:,4)=double(RED(:,:,4)*0.00002);
R1(:,:,4)=R(:,:,4)+0.1;
toar(:,:,4)=R1(:,:,4)/0.9279549148;
figure, imshow(toar(:,:,4))
figure, imshow(Atoa(:,:,2))
%%%%Reflectancia superficie%%%%
ASi(:,:,2)=double(geotiffread('B1.TIF'));
RSi(:,:,4)=double(geotiffread('B3.TIF'));
AS(:,:,2)=ASi(:,:,2)/10000;
RS(:,:,4)=RSi(:,:,4)/10000;
%%%%AOT%%%%
F=@(t)((0.665483767.*(Atoa(:,:,2)-0.091226952-((exp(-1 .*(0.242593401+t(:,:,2))).*exp(-1 .*(0.242593401+t(:,:,2))/0.927954915).*AS(:,:,2))./(1-AS(:,:,2).*(0.92.*0.242593401+(1-0.725681).*t(:,:,2)).*exp(-1 .*(0.242593401+t(:,:,2)))))))-t(:,:,2));
X(:,:,2)=fzero(F,1);
%%%Guardar%%%
[im1,Referencia]=geotiffread('LC80280452015160LGN00_B2.TIF');
info=geotiffinfo('LC80280452015160LGN00_B2.TIF');
geotiffwrite('toar',toar,Referencia,'GeoKeyDirectoryTag', info.GeoTIFFTags.GeoKeyDirectoryTag);
this is te equation wich I'm having trouble.
where PTOA, Ps, and Ta are images
  1 Comment
dpb
dpb on 11 Jun 2016
>> help fzero
...
fun is the function whose zero is to be
computed. It accepts a scalar x and returns a scalar f
Your function doesn't play by the rules it would appear.

Sign in to comment.

Answers (1)

Ian Hunter
Ian Hunter on 20 Feb 2019
You probably want to try one of matlab's optimization routines where you've set the optimization function to be at a minimum when your function crosses 0.
fmincon is an example.

Community Treasure Hunt

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

Start Hunting!