Solving Dependant Integrals in MATlab

In summary: F(\theta^'). Roger Cortesi tried to solve the problem using MATlab and the symbolic maths toolkit, but the script broke for more complex functions. He needs ways of going about it using trapz() or any other recommendable numerical solutions, but he is still finding it hard to wrap his head around where to start. Any ideas?
  • #1
Zandman
2
0
Hi i need to create a MATlab m file solving the following function for 0 to 90 degrees of \theta_0 and for any function F(\theta^').

[PLAIN]http://rogercortesi.com/eqn/tempimagedir/eqn9903.png

[edit] dx should be d\theta^', sorry about that.

I managed to do it in MATlab using symbolic maths toolkit and the int() function, but the script breaks for more complex F(\theta^'). I thus need ways of going about it using trapz() or any other recommendable numerical solutions. But I'm really finding it hard to wrap my head around where to start. Any ideas?

Oh just for interest the formula is used for calculating a reflector antenna's aperture efficiency. Where \theta_0 is the subtended angle or f/d ratio (Focus point), and F(\theta^') is the feed used normally in my case, (sin(x/2))^n, (sin(x))^n or 10^((nx^2)/10)
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
Okay I played around a bit and this is what I've ended up. But there is still problems with the amplitude. Any help will still be appreciated. The aperture efficiency for the given problem below should be between 0.8 and 0.83 but the results are out with a factor bigger than 3000. The shap is correct but the amplitude is just out by a factor.

Code:
clc
clear all

theta = 0:89;   %Angle range

for n= 2:2:8    %Specify range of n
   
    % calculate values for all angles of the integral function
    for i=1:length(theta)   
        angle = theta(i)*pi/180;
        g =(2*(n+1))*((cos(angle))^n);  %The feed 
        int(i) = sqrt(g)*tan(angle/2);  % The integral
    end
    
    %Set initial value of iterative integral sum
    res(1)=int(1);
    for j=2:length(theta)
        res(j) = res(j-1)+int(j);   %calculate and store integral sum for each case
    end

    res = abs(res);     %apply absolute value
    res = res.^2;       %square integral

    %calculate resulting values of complete function
    for k=1:length(theta) 
        res(k) = res(k)*(cot(k*pi/360))^2;
    end

plot(res)
hold on;
grid on;

end
 

1. What is a dependant integral in MATLAB?

A dependant integral in MATLAB is an integral that involves one or more variables or parameters that are defined in the MATLAB workspace. These variables or parameters are used to define the limits of integration and the integrand function.

2. How do I solve a dependant integral in MATLAB?

To solve a dependant integral in MATLAB, you can use the 'int' function. This function takes in the integrand function and the limits of integration as inputs and returns the solution. Make sure to define any variables or parameters used in the integral beforehand in the MATLAB workspace.

3. Can I solve a dependant integral with multiple variables in MATLAB?

Yes, you can solve a dependant integral with multiple variables in MATLAB. You will need to define all the variables used in the integral in the MATLAB workspace and specify the limits of integration for each variable in the 'int' function.

4. What if I get an error while solving a dependant integral in MATLAB?

If you encounter an error while solving a dependant integral in MATLAB, check to make sure that all the variables and parameters used in the integral are defined in the workspace and that the limits of integration are specified correctly in the 'int' function.

5. Are there any special functions for solving dependant integrals in MATLAB?

Yes, MATLAB has a variety of special functions that can be used to solve dependant integrals. These include the 'quad' and 'dblquad' functions for numerical integration and the 'syms' function for symbolic integration. It is recommended to explore and experiment with these different functions to find the best solution for your specific integral.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • Introductory Physics Homework Help
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
806
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
Back
Top