Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
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 comentarios
VBBV
VBBV el 2 de Dic. de 2020
define them inside function and then plot
KSSV
KSSV el 2 de Dic. de 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];

Iniciar sesión para comentar.

Respuestas (1)

Chirag Nighut
Chirag Nighut el 14 de Dic. de 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:

Categorías

Más información sobre Graph and Network Algorithms en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by