I would like to plot with X and Y, when I update the range of X, the vector size would change, so Y need to be assigned again like this:
>> y = sin(x)
If I don’t do that, I normally got:
>> plot (x,y)
Error using plot
Vectors must be the same lengths.
So I wonder, If there’s a way of making that automatically done
You could make
ya function (handle),Of course with such a simple function you could just stick with
sintoo, i.e.You could combine the
plotcommand too to simplify the call further:such that you can call
for any input
x