Borrar filtros
Borrar filtros

Hi, why am I getting an error?

4 visualizaciones (últimos 30 días)
Gabriele Maduri
Gabriele Maduri el 12 de Jun. de 2024
Comentada: Gabriele Maduri el 16 de Jun. de 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');
Error using load
Unable to find file or directory '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 comentarios
Shivani
Shivani el 12 de Jun. de 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.
Gabriele Maduri
Gabriele Maduri el 12 de Jun. de 2024
thanks for the reply but my problem is in the plot below.
I ran the code by accident in mathworks and it saved it for me like this.
the error are below:
plot(F_sept_1,'r')
plot(F_lat_1,'b')

Iniciar sesión para comentar.

Respuesta aceptada

Aquatris
Aquatris el 12 de Jun. de 2024
Editada: Aquatris el 12 de Jun. de 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);
mdl =
Linear regression model: y ~ 1 + x1 + x2 + x3 Estimated Coefficients: Estimate SE tStat pValue __________ _________ _________ __________ (Intercept) 47.977 3.8785 12.37 4.8957e-21 x1 -0.0065416 0.0011274 -5.8023 9.8742e-08 x2 -0.042943 0.024313 -1.7663 0.08078 x3 -0.011583 0.19333 -0.059913 0.95236 Number of observations: 93, Error degrees of freedom: 89 Root Mean Squared Error: 4.09 R-squared: 0.752, Adjusted R-Squared: 0.744 F-statistic vs. constant model: 90, p-value = 7.38e-27
plot(mdl)
plot(mdl,'b')
Error using classreg.regr.modelutils.parseParentAxesNVArg (line 6)
Wrong number of arguments.

Error in LinearModel/plot (line 44)
varargin = classreg.regr.modelutils.parseParentAxesNVArg(ax, varargin);

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by