Info

This question is closed. Reopen it to edit or answer.

iam getting errors while performing integation

1 view (last 30 days)
Loknadh Ch
Loknadh Ch on 21 Feb 2013
Closed: MATLAB Answer Bot on 20 Aug 2021
I1=∫ exp(j β z) δk1 r j1(r)[sin2 φj0(x)+cos2φj1 (x)/x]d z
This is expression.
I need integration within the limits of 0:l
My Matlab Code is:
clc;
clear all;
close all;
j=sqrt(-1);
delta = 0.05;
lambda=0.03;
beta0=209.5;
beta1=209.4;
l=6*lambda;
k1=sqrt(beta0^2-beta1^2);
a=0.03;
r=k1*a;
theta=90;
phi=0;
beta= (2* pi )/ lambda;
x=beta0 * a* sin(theta);
for z=0:l
i= (exp(j*beta*z))* delta * k1 * r* besselj(1,r)* (besselj(1,x)/x)
end
int(i,z,0,l)
Error is
Undefined function or method 'int' for input arguments of type 'double'.
Error in ==> int(i,z,0,l)

Answers (1)

Walter Roberson
Walter Roberson on 21 Feb 2013
int() is for symbolic integration, if you have the symbolic toolbox. There are other routines for numeric integration, such as integral() if you have a new enough MATLAB, and otherwise routines such as quadgk() [amongst others]
I suggest you try
i = @(z) (exp(j*beta*z))* delta * k1 * r* besselj(1,r)* (besselj(1,x)/x);
integral(i, 0, 1)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!