How can put the numbers in line eqution?

1 次查看(过去 30 天)
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);

采纳的回答

Sulaymon Eshkabilov
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Financial Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by