Hi all,
I have a simple question : Let us define the function z = sqrt(x^2 + y^2) if r < 0.9 and r=0 else. I would like to plot the profile along a line defined by a polar angle A, see the figure within the code or enclosed :
[x,y] = meshgrid(-1:0.1:1);z = sqrt(x.^2 + y.^2); % or it can be z = x+y or any f(x,y)...
z(sqrt(x.^2 + y.^2) > 0.9)=0; % set the area where z is defined
ax = axes;h = imagesc(ax,-1:0.1:1,-1:0.1:1,z);set(ax,'YDir','normal');% The function is plotted
% Now we plot the line where I want to get the z-profile
A = 30; % in deg
x0 = cos(deg2rad(A));y0 = sin(deg2rad(A));hold onplot(ax,[-x0 0 x0],[-y0 0 y0],'k-');%end of code
I would like to get the profile along the black line direction. I have played with mesh, surf, etc.. but it does not give the result I want. But I am quite new at MATLAB…
Any help is appreciated 🙂 B
Best Answer