How to assign 'null values' to certain ranges of an equation based on a criteria?
Afficher commentaires plus anciens
Hi guys,
I have two equations. I want one of those (Eq2) to only have valid values when Eq1 is yielding positive values. For all the negative values of Eq1 for given x,y, I want Eq2 to give null or invalid values.
Here's the sample:
x=[-10:10];
y=[-10:10];
Eq1 = @(x,y) x - y;
Eq2 = @(x,y) x + y;
[X,Y] = meshgrid(x,y);
Z1 = Eq1(X,Y);
Z2 = Eq2(X,Y);
Basically: I want Eq2 to have values for only those x,y where Eq1 is >= 0. For all x,y where Eq1 is < 0, I want Eq2 to have invalid/null values. So that when I go to graph Eq2 or just pull values from it, it only does it for areas where Eq1 is >= 0.
Is this possible?
Thank you
Réponse acceptée
Plus de réponses (1)
Catégories
En savoir plus sur Numeric Solvers dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!