Skip to content

Instantly share code, notes, and snippets.

@rezamarzban
Last active January 23, 2024 14:30
Show Gist options
  • Save rezamarzban/2868b81c9157991669708ad2149622e4 to your computer and use it in GitHub Desktop.
Save rezamarzban/2868b81c9157991669708ad2149622e4 to your computer and use it in GitHub Desktop.
MATLAB Poynting Vector integral without symbolic pkg
% Define farfield radiation electric field (E) and magnetic field (H) functions
E = @(r, theta, phi) your_electric_field_function(r, theta, phi);
H = @(r, theta, phi) your_magnetic_field_function(r, theta, phi);
% Define spherical region of integration
rmin = your_min_r_value;
rmax = your_max_r_value;
thetamin = your_min_theta_value;
thetamax = your_max_theta_value;
phimin = your_min_phi_value;
phimax = your_max_phi_value;
% Create anonymous function for Poynting vector in spherical coordinates
PoyntingVectorSpherical = @(r, theta, phi) r^2 * sin(theta) * real(cross(E(r, theta, phi), conj(H(r, theta, phi))));
% Perform the integral over the specified spherical region
integral_result_spherical = integral3(PoyntingVectorSpherical, rmin, rmax, thetamin, thetamax, phimin, phimax);
disp(['Integral of Poynting Vector over the specified spherical region: ', num2str(integral_result_spherical)]);
@rezamarzban
Copy link
Author

  • You do not need to do a Poynting Vector integral over r to getting radiation power, Only over Theta and Phi is needed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment