How to show equation or formula of Regression on matlab?

1 vue (au cours des 30 derniers jours)
Afifah Shabrina
Afifah Shabrina le 31 Oct 2020
Modifié(e) : Adam Danz le 31 Oct 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 commentaire
Adam Danz
Adam Danz le 31 Oct 2020
Modifié(e) : Adam Danz le 31 Oct 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"?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Descriptive Statistics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by