it says it cant plot because my vectors aren't the same size but they are
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
yvec=[6.67 17.33 42.67 37.33 30.10 29.31 28.74];
xvec=[0 6 10 13 17 20 28];
xvar=0:.001:28;
yvar=P_N(xvec,yvec,xvar);
plot(xvar,yvar,xvec,yvec,'r*')
trying to run this code but it says
Error using plot
Vectors must be the same length. anyone know how to fix this?
0 Commenti
Risposte (1)
Torsten
il 19 Mar 2023
Check whether size(yvar) equals size(xvar).
I think this cannot be true because the following code works:
yvec=[6.67 17.33 42.67 37.33 30.10 29.31 28.74];
xvec=[0 6 10 13 17 20 28];
xvar=0:.001:28;
%yvar=P_N(xvec,yvec,xvar);
yvar = rand(size(xvar));
plot(xvar,yvar,xvec,yvec,'r*')
3 Commenti
Torsten
il 19 Mar 2023
You call P_N as
yvar=P_N(xvec,yvec,xvar);
and the function is given as
function [out] = P_N(xvar,xvec,yvec)
Do you see that the inputs in the call to P_N are in the wrong order ?
Vedere anche
Categorie
Scopri di più su Spreadsheets in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!