필터 지우기
필터 지우기

How to show equation or formula of Regression on matlab?

조회 수: 1 (최근 30일)
Afifah Shabrina
Afifah Shabrina 2020년 10월 31일
편집: Adam Danz 2020년 10월 31일
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