Matlab Introduction Course for Undergrads

1 vue (au cours des 30 derniers jours)
Hakan Ole Ensrud Abediy
Hakan Ole Ensrud Abediy le 23 Sep 2016
Commenté : Walter Roberson le 16 Août 2019
Hey, I have following function
x = linspace(-0.5,0.5);
y = linspace(-0.5,0.5);
[X,Y] = meshgrid(x,y);
V = 4*(((exp(-20*(((X-0.25)^2) + (Y-0.25)^2)))) + exp(-20*(((X-0.25)^2 + (Y-0.75)^2))) + exp(-20*(((X-0.75)^2 + (Y-0.5)^2))));
figure
contour(X,Y,V,'ShowText','on')
I want to display the function text so I can debug, because Matlab only outputs arrays with zeros. So something is wrong with how I typed in the function.
i.e
Is this possible in MATLAB 2016b?
Thank you
  5 commentaires
Rena Berman
Rena Berman le 14 Sep 2017
(Answers Dev) Restored edit
Rena Berman
Rena Berman le 26 Déc 2017
(Answers Dev) Restored edit

Connectez-vous pour commenter.

Réponses (2)

Walter Roberson
Walter Roberson le 24 Sep 2016
Your bug is that you used the ^ operator instead of the .^ operator. For a square matrix Z, Z^2 is Z*Z, the matrix algebraically multiplied by itself, whereas you want Z.*Z, which is each element multiplied by itself.

shegaw mamo
shegaw mamo le 16 Août 2019
function dx = cancerhealthcells(~, x)
dx = [2; 1];
L=15;
ommega=50
alpha1 = 0.1;
alpha2 = 0.45;
kappa1 = 0.65;
kappa2 = 1;
beta1 = 0.11;
beta2 = 0.15;
epsilon = 0.05;
gamma = 0.35;
dx(1) = alpha1*x(1)-alpha1*x(1).^2./kappa1-beta1*x(1)*x(2)-epsilon*gamma*x(1);
dx(2) = alpha2*x(2)-alpha2*x(2).^2./kappa2-beta2*x(1)*x(2)-gamma*x(2);
Question: Ommega and L are not in the system of equation. How we can develop matlab syntax including ommega and L using ode45?
  1 commentaire
Walter Roberson
Walter Roberson le 16 Août 2019
What leads you to expect that they should be present?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Desktop dans Help Center et File Exchange

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

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

Start Hunting!

Translated by