Linear fit for a intensity plot (surface plot)
Mostrar comentarios más antiguos
Hi,
I want to find the rotation angle of this plot. (Angle with respect to the horizontal axis.)

In order to do that I'm thinking of doing a linear fit and get the gradient. Something like this:

How can I do a linear fit to this surface plot?
Thank you.
5 comentarios
Mathieu NOE
el 8 de Mzo. de 2021
hello
do you have the data or do you have only this picture ?
S
el 8 de Mzo. de 2021
Mathieu NOE
el 8 de Mzo. de 2021
So first attempt here .... but my linear fit seem a bit off
I smoothed first a bit the data and search for peak location at each row.
the red line is the line of maximum values , but visually it seems not truly aligned with our expectation

data = readmatrix('Rotation.txt');
[m,n] = size(data);
% [val,ind] = max(data,[],'all');
dataS = smooth2a(data,1,7);
x=0;
y=0;
k=0;
for ci = 15:40
k = k+1;
[val,ind] = max(dataS(ci,:));
x(k) = ind;
% zz= cumtrapz(dataS(ci,:));
% x(k) = interp1(zz,1:109,max(zz/2));
y(k) = ci;
end
figure(1),imagesc(dataS)
hold on
plot(x,y,'r')
hold off
axis('xy');
% axis('equal');
slope = mean(diff(y))./mean(diff(x));
angl = atan(slope) % in radians
Image Analyst
el 8 de Mzo. de 2021
Unrecognized function or variable 'smooth2a'.
Error in test5 (line 14)
dataS = smooth2a(data,1,7);
S
el 8 de Mzo. de 2021
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Geographic Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
