%EEMAG1 Fall 99
%S. Mandayam, ECE, Rowan University
%Vector Algebra: Dot and Cross Products

close all; clear;
x = 0:0.25:1.5; y = 0:0.25:1.5;
[xx,yy] = meshgrid(x,y);     

Ax=2*ones(size(xx)); Ay=zeros(size(xx));
Bx=sin(xx.*yy); By=exp(-(xx.^2+yy.^2));

figure;quiver(xx,yy,Ax,Ay,0.5);
rotate3d;
xlabel('x');ylabel('y');
title('Vector Field: {\bf A} =  2 {\bf x} ');

pause;

figure;quiver(xx,yy,Bx,By);
rotate3d;
xlabel('x');ylabel('y');
title('Vector Field: {\bf B} =  sin(xy) {\bf x} + e^{-(x^2+y^2)}{\bf y}');

pause;

A_dot_B = Ax.*Bx + Ay.*By;
figure;surf(x,y,A_dot_B);shading interp; rotate3d;
xlabel('x');ylabel('y');zlabel('{\bf A \cdot B}');
title('Scalar Field: {\bf A \cdot B}');

pause;

A_cross_B_z = Ax.*By;
figure;quiver3(xx,yy,zeros(size(xx)),0,0,A_cross_B_z,2,'r'); rotate3d;
xlabel('x');ylabel('y');zlabel('z');
title('Vector Field: {\bf A \times B}');



