Meshing a complex function with limits
Mostrar comentarios más antiguos
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.

1 comentario
Haider Anjum
el 27 de Nov. de 2019
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Surface and Mesh Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!