0% found this document useful (0 votes)
40 views1 page

Codigo 3.2

This script allows a user to calculate the divergence and curl of a vector field given symbolically. It uses the diff() function to take derivatives and calculate the divergence and curl. The user inputs the symbolic vector and the script evaluates the divergence and curl at a sample point.

Uploaded by

Topix0496
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views1 page

Codigo 3.2

This script allows a user to calculate the divergence and curl of a vector field given symbolically. It uses the diff() function to take derivatives and calculate the divergence and curl. The user inputs the symbolic vector and the script evaluates the divergence and curl at a sample point.

Uploaded by

Topix0496
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

% This script allows the user to find the divergence and curl

% of a vector field given in symbolic from


% It uses the build-in symbolic derivate function
% called diff() to compute the derivates clear
syms x y z % declare x, y, z to be symbols (variables)

% Prompt the user to enter the symbol vector


% For example the user could enter [y*2 4*x*y y]
disp('Enter the symbolic vector (in the format ');
A = input('[fx(x,y,z) fy(x,y,z) fz(x,y,z)]=... \n > ');

% The divergence of A
% e.g. diff(A(2), z) means the derivative of the
% y-component of vector A with respect to z
divA=diff(A(1),x)+...
diff(A(2),x)+...
diff(A(3),x)+...
% evualuate divergence at point (x,y,z) = (1, -2, 3)
subs(divA,{x,y,z},{1, -2, 3})

% The curl of A
% e.g. diff(A(2),z) means the derivative of the
% y-component of vector A with respect to z
curlA=[diff(A(3),y)-diff(A(2),z),...
-diff(A(3),x)+diff(A(1),z),...
diff(A(2),x)-diff(A(1),y)]
% evaulate curl at point (x,y,z) = (1, -2, 3)
subs(curlA,{x,y,z},{1, -2, 3})

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy