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

1 次查看(过去 30 天)
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 个评论
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