Problem:
Plot the egg holder function and find the global optimizer in Matlab
Eggholder function:
Y= -(u2+47)*sin(sqrt(abs((u2)+(u1/2)+(47)))) - (u1)*sin(sqrt(abs((u1)-(u2+47))))
where u equals x
Below is my code and the picture of the graph I got. I know for a fact that it's wrong but don't know how to fix it.

<
x1=[-600:10:600];
x2=[-600:10:600];
[u1, u2] = meshgrid(x1, x2);
term1=-(u2+47)*sin(sqrt(abs((u2)+(u1/2)+(47))));
term2=-(u1)*sin(sqrt(abs((u1)-(u2+47))));
y=term1+term2;
figure
surf(u1,u2,y)
>
Please show all work and explain what you're doing so that I can understand the process.
There is just slight modification in the code provided here. Since x1 and x2 are array, while multiplying, we have to use (.*) for element wise multiplication in the expression of term1 and term2.
Below is the corrected code :
%To create the meshgrid of two variables x1 and x2 varying from
-600 to 600
%with an interval of 10
[x1, x2] = meshgrid(-600:10:600, -600:10:600);
%First Term of eggholder function
term1= -(x2+47).*sin(sqrt(abs((x2)+(x1/2)+(47))));
%Second Term of eggholder function
term2= -(x1).*sin(sqrt(abs((x1)-(x2+47))));
y=term1+term2;
figure
% Surface Plot
surf(x1,x2,y)
title('Eggholder Function')

Problem: Plot the egg holder function and find the global optimizer in Matlab Eggholder function: Y=...
Can you please help me answer Task 2.b?
Please show all work.
fs=44100; no_pts=8192;
t=([0:no_pts-1]')/fs;
y1=sin(2*pi*1000*t);
figure;
plot(t,y1);
xlabel('t (second)')
ylabel('y(t)')
axis([0,.004,-1.2,1.2]) % constrain axis so you can actually see
the wave
sound(y1,fs); % play sound using windows driver.
%%
% Check the frequency domain signal. fr is the frequency vector and
f1 is the magnitude of F{y1}.
fr=([0:no_pts-1]')/no_pts*fs; %in Hz
fr=fr(1:no_pts/2); % single-sided spectrum
f1=abs(fft(y1)); % compute fft
f1=f1(1:no_pts/2)/fs;
%%
% F is the continuous time Fourier. (See derivation...
Game Description: Most of you have played a very interesting game “Snake” on your old Nokia phones (Black & White). Now it is your time to create it with more interesting colors and features. When the game is started a snake is controlled by up, down, left and right keys to eat food which appears on random locations. By eating food snake’s length increases one unit and player’s score increases by 5 points. Food disappears after 15 seconds and appears...