Error using plot Vectors must be the same length. ı have a plot error .İs there any advicethis problem

1 view (last 30 days)
figure(3)
N1=linspace(2000,3400);
p = polyfit(Nwot,bsfcwot,2);
bsfc1=polyval(p,N1);
p1=plot(N1,bsfc1);
hold on;
xlim([2200 3400])
ylim([0 0.5])
hold on;
indexmin = find(min(bsfc1) == bsfc1);
Nbsfcmin = N1(indexmin)
bsfcmin = bsfc1(indexmin)
plot([Nbsfcmin ],[bsfcmin 0 ],'r--')
hold on;
plot([0 Nbsfcmin],[ bsfcmin 0],'r--')
Error in Untitled3 (line 219)
plot([Nbsfcmin ],[bsfcmin 0 ],'r--')

Answers (1)

Cris LaPierre
Cris LaPierre on 3 Apr 2022
Edited: Cris LaPierre on 3 Apr 2022
There are not enough details to say why your vectors are not the same length, but your X and Y vectors are not the same length in one of your plot commands. You must have an X and Y value for each element.
% works
plot([1 2],[2 5])
% doesn't work
plot([1 2],[2 5 8])
Error using plot
Vectors must be the same length.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!