How to plot a fitted curve?
    9 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
Hello,
I would like to fit a curve with the following function: y=a-b*c^x
I used this expression with matlab: ft=fittype('a-b*c^x') However,I have a problem when I plot the fit.
I get this message:
Error using plot Conversion to double from fittype is not possible.
Error in project8 (line 149) plot(ft,y2,Av)
0 comentarios
Respuestas (1)
  Wayne King
    
      
 el 18 de Dic. de 2013
        
      Editada: Wayne King
    
      
 el 18 de Dic. de 2013
  
      Did you actually call fit() after you definted your fit type?
a = 2;
b = 3;
x = (0:100)';
y = 2-3*x;
ft=fittype('a+b*x') 
f = fit(x,y,ft);
plot(f)
hold on;
plot(x,y)
2 comentarios
  Wayne King
    
      
 el 18 de Dic. de 2013
				I was just showing you an example, not trying to do exactly what you are trying to do. I think I answered your question then, the problem is you have to use fit() to obtain the actual fit.
Ver también
Categorías
				Más información sobre Line Plots en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

