Sampling a function.
23 views (last 30 days)
Show older comments
Hello everyone, I am working on the following problem statement:
"Consider the analytic function ( 1 + cos 2 π ( f_1 x + f_2 y ) ), where f 1 , f 2 are a spatial frequencies with units of m-1, and x , y are spatial variables with units of m. This function is to be sampled with a 2-D ideal sampling function. Pick the frequencies with the condition that f 1 ≠ f 2, and then compute and display as an image the ideally spaced samples in a square array that is at least 10 periods on a side for the lower frequency. Then, compute and display the samples for a sampling function which undersamples in both dimensions. "
So far I have only been able to plot a contour and a 3D plot for this function by writing the following code below. I am utterly lost at how to sample this function by a ' 2D ideal sampling function'. Any help is much appreciated.
clc;
close all;
clear all;
f_1=100;
f_2=200;
%f_1 = input('Enter first frequency: ');
%f_2 = input('Enter second frequency (not equal to first frequency!): ');
zfun = @(x,y) 1+cos(2*pi*(f_1*x + f_2*y));
zhandle = fcontour(zfun)
[x,y] = meshgrid(-10:.2:10);
%f = 1+cos(2*pi*(f_1*x + f_2*y));
surf(x,y,1+cos(2*3.14*(f_1*x + f_2*y)))
3 Comments
Image Analyst
on 12 Oct 2020
Perhaps "display as an image" means that you use imshow(), image(), or imagesc() instead of surf() which does a topographical/perspective rendering.
Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!