Hi, why am I getting an error?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Gabriele Maduri
le 12 Juin 2024
Commenté : Gabriele Maduri
le 16 Juin 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 commentaires
Shivani
le 12 Juin 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.
Réponse acceptée
Aquatris
le 12 Juin 2024
Modifié(e) : Aquatris
le 12 Juin 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')
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Shifting and Sorting Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!