MATLAB: How to draw a 3D graph with constraints 3d plotsconstraints I want to draw a 3D graph for a function with several contraints. For example, f(x,y)=1-0.5*x-0.7*y such that 0<=x<=1, 0<=y<=1, 0<=x+y<=1. Since I am a beginner of using MATLAB, so any help would be very appreciated. Best Answer The simple answer is to just use meshgrid.[x,y] = meshgrid(linspace(0,1,100));keepind = (x + y) <= 1;x(keepind) = NaN;y(keepind) = NaN;f = 1 - .5*x - .7*y;surf(x,y,f) Related SolutionsMATLAB: Fsolve How to pass several functions f=@(x,y) [x+y^2-5; x+y-3];z = fsolve(@(p) f(p(1),p(2)),x0); MATLAB: Dear Reserach Team! I need to calculate numerically definite integral of a function g(y), where g(y) is a numerical integral of f(x,y). Please advise how to do it (the details are shown below). Many thanks in advance!. function main g = @(y) integral(@(x)f(x,y),0,1); s = integral(g,0,2,'ArrayValued',true)endfunction fun_f = f(x,y) if y==0 fun_f = x.^2; else fun_f = x.*sin(x.*y)./y; endend Related QuestionCreate 3D plot for beginnersHow to use calculated value from first question to calculate in another equation at the same time3D plotting of equation
Best Answer