How to show equation or formula of Regression on matlab?

1 Ansicht (letzte 30 Tage)
Afifah Shabrina
Afifah Shabrina am 31 Okt. 2020
Bearbeitet: Adam Danz am 31 Okt. 2020
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 Kommentar
Adam Danz
Adam Danz am 31 Okt. 2020
Bearbeitet: Adam Danz am 31 Okt. 2020
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"?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Descriptive Statistics 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!

Translated by