How can put the numbers in line eqution?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
MOzhdeh Salimi
am 3 Sep. 2021
Kommentiert: Sulaymon Eshkabilov
am 3 Sep. 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);
0 Kommentare
Akzeptierte Antwort
Sulaymon Eshkabilov
am 3 Sep. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Financial Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!