필터 지우기
필터 지우기

need help to plot x,y data points with 'o' without line and y_hat smooth graph

조회 수: 2 (최근 30일)
Ahmed
Ahmed 2020년 12월 2일
답변: Chirag Nighut 2020년 12월 14일
function [m,n] = exp_n(x,y)
X=x;Y=log(y);
Pn=polyfit(X,Y,1);
n=Pnfit_sq(1,1)
m=exp(Pnfit_sq(2))
tau = 1/a*-1
y_hat=c*exp(a*x);
end
%x=[0 .5 1 1.5 2 2.5 3 3.5 4 4.5 5];
%y=[0 -5.27 -8.10 -8.46 -6.38 -1.84 5.15 14.59 26.48 40.83 57.63];
  댓글 수: 3
VBBV
VBBV 2020년 12월 2일
define them inside function and then plot
KSSV
KSSV 2020년 12월 2일
function y_hat = exp_n(x,y)
X=x;Y=log(y);
Pn=polyfit(X,Y,1);
n=Pnfit_sq(1,1)
m=exp(Pnfit_sq(2))
tau = 1/a*-1
y_hat=c*exp(a*x);
end
plot(x,y_hat,'-o')
%x=[0 .5 1 1.5 2 2.5 3 3.5 4 4.5 5];
%y=[0 -5.27 -8.10 -8.46 -6.38 -1.84 5.15 14.59 26.48 40.83 57.63];

댓글을 달려면 로그인하십시오.

답변 (1개)

Chirag Nighut
Chirag Nighut 2020년 12월 14일
You can use the plot function and use an option for styling the line plot to show the line as -o
plot(x,y_hat,'-o')
Above line of code should help.
To know more about plot line styles and other options please refer the following link:

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by