Error using * Inner matrix dimensions must agree.

3 vues (au cours des 30 derniers jours)
srinu vas
srinu vas le 20 Avr 2017
Commenté : srinu vas le 20 Avr 2017
I am trying from two days please Help
thank you ..
full code ......
Red = geotiffread('C:\Users\Adya\Desktop\matlab_workshop\LST\LST\images\band2.tif');
%figure(1),imshow(Red),title('BandRed');
NIRed = geotiffread('C:\Users\Adya\Desktop\matlab_workshop\LST\LST\images\Band3.tif');
%figure(2),imshow(NIRed),title('BandNIR');
R = histeq(Red);
NIR = histeq(NIRed);
R = im2double(R);
NIR = im2double(NIR);
%Estimation of NDVI
ndvi = (NIR -R) ./ (NIR + R);
%figure(3),imhist(ndvi)
%figure(4),imshow(ndvi, []), title('NDVI');
%text(size(ndvi,2), size(ndvi,1) + 15,...
% 'Positive values shows the Vegetation and Negative values shows the NoneType Vegetation',...
%'FontSize', 8, 'HorizontalAlignment', 'right');
%colormap(jet),colorbar;
%impixelinfo
%Estimation of Land Surface Emissivity%%
%NDVIs = soils
%NDVIv = Vegetation
NDVIs = 0.2;
NDVIv = 0.5;
Pv = (ndvi - NDVIs) ./ (NDVIv - NDVIs);
%ndvi = Pv
ndvi = (Pv.^2);
%COEFFICIENTS FOR THE ATMOSPHERIC IS Cj
Cj = 1;
%E = (0.004*ndvi+ 0.990*(1-ndvi));
%figure(6),imshow(E)
%colormap(jet),colorbar;
%impixelinfo
Ei = (NDVIs*ndvi + NDVIv*(1-ndvi) + Cj);
%figure(5),imshow(Ei),title('Emissivity');
%colormap(jet),colorbar;
%impixelinfo
%Conversion of Digital Numbers (DNs) to Radiance
DN = geotiffread('C:\Users\Adya\Desktop\matlab_workshop\LST\LST\images\band14.tif');
DN = histeq(DN);
DN = im2double(DN);
%figure(),imshow(DN),title('Band14');
UCC = 0.005693;
L = (DN-1)*UCC;
%figure,imshow(L);
Conversion of Radiance to Brightness Temperature
K1 = 649.60;
K2 = 1274.49;
BT = ((K2) ./ log(((K1) ./ (L)) + 1));
% Y Lamb
y = 11.289;
%BT = (BT);
P = ((1.438)*(10.^-2));
%%calculation of LST
LST = (BT)./{1 + (y*(BT)./P)*log(Ei)};
%%imhist(LST),title('LST')
figure(6),imshow(LST),title('LST')
colormap(jet);
impixelinfo
%filename = 'C:\Users\Adya\Desktop\matlab_workshop\LST\LST\images\geotiffexample.tif';
%geotiffwrite(filename,LST);
  2 commentaires
Walter Roberson
Walter Roberson le 20 Avr 2017
Which line is the problem occurring on?
We do not have your data files so we cannot run your code to test it.
srinu vas
srinu vas le 20 Avr 2017
thank you LST Variable line getting problem please run it ,I will send my data but I dn not have to send data from here thank you

Connectez-vous pour commenter.

Réponse acceptée

James Tursa
James Tursa le 20 Avr 2017
Modifié(e) : James Tursa le 20 Avr 2017
Maybe you need to do element-wise multiply for that calculation using the .* operator (with the dot in the front) instead of the matrix multiply operator * (without the dot).
Also, not sure what you expect as a result when dividing by a cell. E.g., this line
LST = (BT)./{1 + (y*(BT)./P)*log(Ei)};
Did you mean for those curly braces { } to be parentheses instead ( ) ?
  1 commentaire
srinu vas
srinu vas le 20 Avr 2017
I was tried all ways getting same Error. THANK YOU

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by