How can put the numbers in line eqution?

1 visualización (últimos 30 días)
MOzhdeh Salimi
MOzhdeh Salimi el 3 de Sept. de 2021
Comentada: Sulaymon Eshkabilov el 3 de Sept. de 2021
Hi
This is my code. I want put ('X') data in line equation ('p'). After run ('polyfit') code, just I could see the two numbers that refer to coefficients. now I want to put the series of numbers in the line regression equation ('p').
please help me.
Thanks.
VF = imread('Vf.tif');
Tnormal= imread('Tnormmsh.tif');
[i,j]=size(VF);
length=i*j;
X=VF(1:length);
Y=Tnormal(1:length);
Minx=min(X);
Maxx=max(X);
Miny=min(Y);
Maxy=max(Y);
x0=Minx:0.01:Maxx;
Tmax=zeros(size(x0));
for i = 1:1:numel(x0)
x1 = x0(i);
X1=x1;
X2=x1+0.01;
idx= find(X>=X1 & X<X2);
x3=X(idx);
y3=Y(idx);
Tmax(i)=max(y3) ;
end
p=polyfit(x0,Tmax,1);

Respuesta aceptada

Sulaymon Eshkabilov
Sulaymon Eshkabilov el 3 de Sept. de 2021
There are a few points can be fixed and improved in your code, e.g.:
...
X=double(VF(1:length)); % Conversion to double() needed
Y=double(Tnormal(1:length)); % Conversion to double() needed
...
p=polyfit(x0,Tmax,1);
Pval=polyval(p, X); % The values of Fit model computed
  2 comentarios
MOzhdeh Salimi
MOzhdeh Salimi el 3 de Sept. de 2021
Thank you so much.
Sulaymon Eshkabilov
Sulaymon Eshkabilov el 3 de Sept. de 2021
Most welcome!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Workspace Variables and MAT-Files en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by