Hi, why am I getting an error?
    3 views (last 30 days)
  
       Show older comments
    
    Gabriele Maduri
 on 12 Jun 2024
  
    
    
    
    
    Commented: Gabriele Maduri
 on 16 Jun 2024
            it gives me an error on the plot function. The error message is: 
Error using LinearModel/plot 
Wrong number of arguments.
load ('DATI_PAZ1');
LV_1=LV;
lat_1=lat;
sept_1=sept;
time_1=time;
load ('DATI_PAZ2');
LV_2=LV;
lat_2=lat;
ant_2=ant;
time_2=time;
figure
plot(time_1,LV_1,'k')
hold on
plot(time_1,lat_1,'b')
hold on
plot(time_1,sept_1,'r')
grid on
xlabel('time [s]'),ylabel('colpi/(s*voxel)')
title('Conc. FDG - CASO I')
legend('ventr.sx','laterale','setto')
figure
plot(time_2,LV_2,'k')
hold on
plot(time_2,lat_2,'b')
hold on
plot(time_2,ant_2,'r')
grid on
xlabel('time [s]'),ylabel('colpi/(s*voxel)')
title('Conc. FDG - CASO II')
legend('ventr.sx','laterale','anteriore')
y_lat_1=lat_1./LV_1;
y_sept_1=sept_1./LV_1;
x_1=cumtrapz(time_1,LV_1)./LV_1;
figure
subplot(1,2,1)
plot(x_1,y_lat_1,'*b')
hold on
plot(x_1,y_sept_1,'*r')
title('Patlak graph - CASO I')
F_sept_1=fitlm(x_1(18:24,1),y_sept_1(18:24,1),'poly1');
hold on
plot(F_sept_1,'r')  %error 
F_lat_1=fitlm(x_1(18:24,1),y_lat_1(18:24,1),'poly1');
hold on
plot(F_lat_1,'b')   %error
legend('parete laterale','setto')
xlabel('trapz( C_p(t) dt)/C_p(t) [s]'),ylabel('C_t(t)/C_p(t) [adimensionale]')
m_setto_1=F_sept_1.p1;
m_laterale_1=F_lat_1.p1;
2 Comments
  Shivani
      
 on 12 Jun 2024
				As mentioned in the error message, it looks like 'DATI_PAZ1' is not present in the immediate directory. Please make sure you move the file to the immediate directory or provide the full path to the file. 
Accepted Answer
  Aquatris
      
 on 12 Jun 2024
        
      Edited: Aquatris
      
 on 12 Jun 2024
  
      You provide a fitlm model to plot function and a color option. Remove the color option and try again.
So change 
% plot(F_sept_1,'r')  % wrong
% plot(F_sept_1)      % correct
However I think you do not want to plot the whole model but instead the fit probably. So just use the coefficients to evaluate your model at the desired positions and plot that isntead.
Example fitlm output ploting from mathwork and your error with color option:
load carsmall
X = [Weight,Horsepower,Acceleration];
mdl = fitlm(X,MPG);
plot(mdl)
plot(mdl,'b')
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


