Sine wave


(simira) #1

Are this correct?
x = 2; % Sets the resolution (step length), in µm, along the x-axis.
y = 2; % Sets the resolution (step length), in µm, along the y-axis.
z = 1; % Sets the resolution (step length), in µm, along the z-axis.
xLength = 4000; % Sets the length of the surface in X.
yLength = 3000; % Sets the length of the surface in Y.
wavelength = 100;
f = 3sin(x2pi/wavelength[1:4000]) + 1003; % The function for the sine wave with the % amplitude 3 µm and wave length of about 100 µm. Mean
level is % 1003 µm.
I can not plot this function.


#2

يرجى توضيح السؤال اكثر


(simira) #3

I want to create a surface from sine wave function
first I must find the sine wave function then write it in matrix
to print a surface
Thanks


(simira) #4

% Creates a matrix describing a topographical surface
xRes = 2; % Sets the resolution (step length), in µm, along the x-axis.
yRes = 2; % Sets the resolution (step length), in µm, along the y-axis.
zRes = 1; % Sets the resolution (step length), in µm, along the z-axis.
xLength = 4000; % Sets the length of the surface in X.
yLength = 3000; % Sets the length of the surface in Y.
f = @(x) 3sin(x2*pi/100) + 1003; % The function for the sine wave with the
% amplitude 3 µm and wave length of about 100 µm. Mean level is
% 1003 µm.
% Prints the sine wave into a matrix:
A = zeros(yLength/yRes+1,xLength/xRes+1);
for k = 1:length(A(:,1))
for l = 1:length(A(1,:))
A(k,l) = f(l-1);
end
end

Someone write these codes, but there is wrong, when I check it I found the wavelength 200.
I do not know where is the problem?
Thanks


(Ahmed) #5

[CENTER][SIZE=4]السلام عليكم

لقد مررت على سؤالك في منتديات موقع الماتلاب

وتكرر نفس الخطا

المشكل ليس في كتابة البرنامج

بل في تعريفك لبعض المفاهيم

وجدت ان طول الموجة 200

لانه حدث التباس في تعريفك ل
the resolution

فهي تقريبا نفس مفهوم
sampling frequency
بالنسبة لماتلاب

ولو حسبت
4000\2=2000

وانت في كتابتك استخدمت sampling frequency = 100

فطبيعي ان تجدي طول الموجة=2000\100

ساجيبك في سؤالك الاخر
[/size][SIZE=4]

[/size][/center]


(simira) #6

How can I change the resolution without change the wavelength?
Thank you very much