Plotting matrices that don't have the same size
30 views (last 30 days)
I am trying to plot two matrices it doesn't work.
matrix_1 is a 181x1 matrix with different values, I am trying to plot these values and also get a line fitted on the same plot, I tried polyfit as well but it doesn't work.
"Error using plot
Vectors must be the same length."
Ken Atwell on 30 Nov 2018
When calling plot, the length of the x,y pairs must be equal. Here is an example of a plot of x^2 with noise added, then then a polyfit to that data:
f=polyfit(x, y, 2); % Returns coefficients, not y values directly
fy = f(1).*x.^2 + f(2).*x + f(3);