How to assign 'null values' to certain ranges of an equation based on a criteria?
Ältere Kommentare anzeigen
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
Akzeptierte Antwort
Weitere Antworten (1)
Kategorien
Mehr zu Numeric Solvers finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!