Quiver plot details and error

8 views (last 30 days)
Cassandra Meyer
Cassandra Meyer on 8 Jun 2022
Answered: Ayush on 30 Aug 2023
I've been handed a template code to make a quiver plot with little explanation, so I'm trying to learn more about quiver. First, it is giving me errors I don't know how to fix. Specifically, "input arguments must be numeric or objects which can be converted to double" starting with tmin. I was handed it the second way with function in it, but I get the same error (as well as syntax for the parentheses).
syms t y
f = @(t,y) t - y^2;
quiver(f, 0, 5, -3, 10, 'b')
syms t y
f = @(t,y) t-y.^2;
function quiver244(f, 0, 5;-3, 10, 'b')
For quiver plots in general: if I am asked to see how the graph changed when you start at different points, where can I input that? I am asked to prove my output using sampleplots, where I know I can put in a t0 and y0, but I have to do it with quiver first.
Any input would be appreciated.

Answers (1)

Ayush
Ayush on 30 Aug 2023
Hi Cassandra,
I understand that you are facing difficulty in working with the “quiver” function used for plotting in MATLAB.
Regarding the specific error you pointed out i.e. “input arguments must be numeric or objects which can be converted to double", this is caused by the symbolic variables:
sysm t y
This is incompatible with the “quiver” function. It only accepts numeric values or similar objects as mentioned in the error message as well. Refer to the below documentation to know more about the “quiver” function:
Your second question can be catered by changing the initial conditions (“t0” and “y0”) in the definition of your function “f(t,y)”, in order to visualise the change from different starting points. Furthering this purpose, you can also consider different methods of plotting which are more suited for solution trajectories. Refer to the below documentation to know more about the plotting method in MATLAB:
Hope it helps,
Regards,
Ayush Misra

Categories

Find more on Vector Fields in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!