In: Mechanical Engineering
Create a program using Matlab that can solve Three Dimensional Space; Vectors, Partial Derivatives or any of the topic in calculus 3; show 5 examples please thankyou!! just use matlab for the solution like the codes thankyou
2-d functions
:
>> [x,y]=meshgrid(-1:0.1:1,-1:0.1:1);
>> z=5*x.^2+3*y.^2;
>> contour(x,y,z);
>> prism;
>> mesh(x,y,z)
>> surf(x,y,z)
>> view([10 30])
>> view([0 90])
2D Fourier transform intensity
echo on
colormap(hsv);
x=zeros(32);
x(13:20,13:20)=ones(8);
mesh(x)
pause % strike a key
y=fft2(x);
z=real(sqrt(y.^2));
mesh(z)
pause
w=fftshift(z);
surf(w)
pause
contour(log(w+1))
prism
pause
plot(w(1:32,14:16))
title(’fft’)
xlabel(’frequency’)
ylabel(’modulus’)
grid
echo off
Create file alpha.dat . Then:
>> fid=fopen(’alpha.dat’,’r’);
>> a=fread(fid,’uchar’,0)+4;
>> fclose(fid);
>> fid=fopen(’beta.dat’,’w’);
>> fwrite(fid,a,’uchar’);
>> fclose(fid);
>> !cat beta.dat
x est = 7.0;
delta = 0.1;
while(delta > 1.0e-4)
x=x est-delta:delta/10:x est+delta;
fplot(’eqn’,[min(x) max(x)]);
grid;
disp(’mark position of root with mouse button’)
[x est,y est] = ginput(1)
delta = delta/10;
end