Matlab using mesh to plot (Error using mesh (line 76) X, Y, Z, and C cannot be complex) -
i'm trying plot function keep getting 'error using mesh (line 76) x, y, z, , c cannot complex'. found question suggested use of abs on sqrt function not give desired output. output given should this
function [ x,y,z] = plotcomplexfunction( ) %untitled summary of function goes here % detailed explanation goes here x = linspace(-1,1); y = linspace(-2*pi,2*pi); [x,y] = meshgrid(x,y); = sqrt(-1); z = exp(x+(i*y)); mesh(x,y,z) end
it looks plot made using real part of z
. changing line call mesh
to:
mesh(x,y,real(z));
produces plot:
Comments
Post a Comment