How to show equation or formula of Regression on matlab?

1 次查看(过去 30 天)
how to show the regression formula used when i plot the data? I tried to use axes but they still don't appear. Please help me.
clc;
clear all;
data = load('hypodd.reloc');
x = data(:,3); % Long
y = data(:,2); % Lat
z = data(:,4); % Depth
A = [x y ones(length(x),1)]; % independent variable
[cc,bint,r,rint,stats]= regress(z,A); % compile the regression formula
scatter3(x,y,z); % Plot hypocenter
hold on;
x_grid=119:0.05:120;
y_grid=-3.2:0.05:-2.2;
[XFIT, YFIT]=meshgrid(x_grid, y_grid);
AFIT=cc(1)*XFIT+cc(2)*YFIT+cc(3);
surf(XFIT,YFIT,AFIT);
colorbar
title('\fontsize{14} hypocenter cross section fault model');
legend('cross section model',1);
xlabel('Longitude')
ylabel('Latitude')
zlabel('Depth in Kilometers')
  1 个评论
Adam Danz
Adam Danz 2020-10-31
编辑:Adam Danz 2020-10-31
By "regression formula" do you mean text containing the formula?
AFIT=cc(1)*XFIT+cc(2)*YFIT+cc(3);
What do you mean by "I tried to use axes"?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Descriptive Statistics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by