Plotting of null surfaces and Warning: Matrix is singular to working precision.

Problem: I have the following three sets of equation which i need to plot as planes in 3D system.
I ,N and T are there variables representing the null surfaces .Now i don't have to solve them, instead i just have to plot them as planes and see their intersections. Here is the plot i am supposed to get,
graph.png
My attempt: I tried to use meshgrid and surf to plot the plane but i don't understand how to proceed with the first two. The third one i tried like
[T N] = meshgrid(0:0.01:5);
I= (0.33*(0.3+T))/((T+0.2)*(0.3+T)-0.01*T);
surf(T,N,I);
This led me to a warning: Matrix is singular to working precision. I checked if somewhere the denominator vanishes but they don't.
For the second i tried:
[I N] = meshgrid(0:0.01:5);
T= 1-I/3-N/1.5;
surf(I,N,T);
But again this did give something but nothing like the above figure. I could be completly wrong with my attempt here, hence any guidance or a small code will be extremely helpful. The variable I, T, and N are Immune, Tumor and Normal in the above figure.
Thank you.

3 Comments

Hi Vira,
for the first one you need to replace * by .*,
and / with ./ to get element-by-element multplication and division of the matrices making up T. (The dots are not necessary for multiplication or division by a scalar).
[T N] = meshgrid(0:0.04:2);
I = (0.33*(0.3+T))./((T+0.2).*(0.3+T)-0.01*T);
mesh(T,N,I);
Thanks David for the reply. Earlier one member had commented the similar solution as your but seems he deleted his reply.
Though your problem does solve the issue, I was having problem plotting the other equations as a plane in the same plot. Like the second equation along with the code you gave.
Mu problem is do i have to use two different meshgrid to plot the other equations or i can use the same meshgrid.
Let me show what i did.
[T N] = meshgrid(0:0.05:3.5);
I1= (0.33*(0.3+T))./((T+0.2).*(0.3+T)-0.01*T); %the code you suggested
I2= 3-2.*N-3.*T; %this is the second equation with I in LHS
surf(T,N,I1, 'EdgeColor','none');
hold on
surf(T,N,I2, 'EdgeColor','none');
view(30,30)
This doesn't work and hence my problem, how should i proceed to plot all of them in the same graph. Any help or guidance would be helpful.
Thank you.
Hi Vira,
I don't believe the second and third equations correspond to the figure in your question. For the third equation, if you plug in T = 0 you get 1.5 for any N, but the figure shows 5. For the second equation, if you plug in N=0 T=0 you get 3, but the figure (up from the back corner where you can't actually see the origin T=0,N=0) shows 9.

Sign in to comment.

Answers (0)

Categories

Products

Release

R2016a

Asked:

on 18 Dec 2019

Commented:

on 22 Dec 2019

Community Treasure Hunt

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

Start Hunting!