Meshing a complex function with limits
이전 댓글 표시
Hi People
Completely new to matlab coding so will try my best to explain my problems with this code so far:
I am trying to create a mesh in matlab that will reflect the complex function of a optical lens. The code i have so far is this:
%Matlab coding - OTF of ideal lens
%define x and y boundaries, z will be the function
x=(-1:0.03:1);
y=(-1:0.03:1);
%create meshgrid
[X,Y] = meshgrid(x,y);
%define the frequency
rho = (X.^2+Y.^2);
rho0 = 8;
v = rho./2*rho0;
syms z
z=(acos(v) - (v).*sqrt(1-(v).^2));
%surf plot with OTF as Z axis - only interested in real values of z
surf(x,y,real(z));
This code is to reflect the equation in the photo H(rho), the big equation:

My problem is the following:

The wrong shape is simulated, as it has to be the following shape in this final photo:
I know i need to include the limits, but I've no idea how to code this in, whenever i try nd use the "limit" function matlab throws an error saying it can't use the limit function for variable type double.

채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!