How can I normalize vectors for a phase portrait using quiver() ?

I need to plot the vector field for a system of two ODE's, for a model of chemotherapy (x = cells, y = concentration of antineoplastic drug). I would like the vectors in quiver() to have the same length. However, after normalization, quiver() behaves unexpectedly. Instead of just changing vector sizes, all the field gets distorted.
Please help !
%% the parameters
r = 0.2 * 10^(-3);
k = 1.1 * 10^12;
theta = 0.25;
mu = 8 * 10^(-2);
alpha = 5;
lambda = 4.16;
gamma = 0;
%% computing vector field
num_points = 20;
[x, y] = meshgrid( linspace(0, 100, num_points), linspace(0, 3, num_points) );
xdot = r .* x .* (1 - (x./k).^theta) - mu.*y.*x;
ydot = alpha - lambda.*y - gamma.*alpha.*x.*y;
mm = sqrt(xdot.^2 + ydot.^2); % vectors' modules
ff = 1;
xdotn = ff * xdot ./mm ; % normalization
ydotn = ff * ydot ./mm;
%% graphing
subplot(121)
title('Original vectors')
q = quiver(x, y, xdot, ydot)
q.ShowArrowHead = 'off';
xlim([0 100]);
subplot(122)
title('Norvalized vectors')
w = quiver(x, y, xdotn, ydotn) % does not work as I expected
w.ShowArrowHead = 'off';
xlim([0 100]);

Antworten (0)

Kategorien

Mehr zu Vector Fields finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2016a

Gefragt:

am 19 Nov. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by