EE3321 MATLAB ASSIGNMENT 1 1. Consider the function a) Using the meshgrid comman
ID: 3148594 • Letter: E
Question
EE3321 MATLAB ASSIGNMENT 1 1. Consider the function a) Using the meshgrid command, generate a grid for the region-10 sx s 10,-10 S y S 10 in steps of 0.5. Calculate the function in this region. Using the imagesc and colorbar commands, plot the function. Using the gradient command, calculate the gradient of the function. Using the quiver command, plot the gradient. b) In both cases, label all axes and title the plots. 2. Consider the field a) 10,-10 using the meshgrid command, generate a grid for the region-10 y command, plot the field. Using the divergence command, calculate the divergence of the field. Using the contour and colorbar commands, plot the divergence. x 10 in steps of 0.5. Calculate the field in this region. Next using the quiver b) In both cases, label all axes and title the plots. Submit a report that includes the following: cover page (MATLAB assignment number, student name, course number, academic department, university, date), assignment sheet, properly documented code, properly labeled graphs for each problem, description of results (i.e. analysis of graphs)Explanation / Answer
a)
% create the values of x and y in the range -10 to 10 in steps of 0.5
[x,y] = meshgrid(-10:.5:10, -10:.5:10);
%evaluates the function at each x and y
f = -x .* x - y .* y;
%plot the function
imagesc(f);
colorbar;
title('-x * X - y * y');
xlabel('x');
ylabel('y);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.