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

1 view (last 30 days)
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 Comments
KSSV
KSSV on 2 Dec 2020
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];

Sign in to comment.

Answers (1)

Chirag Nighut
Chirag Nighut on 14 Dec 2020
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:

Categories

Find more on Graph and Network Algorithms in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!