Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
how do the integration?

Subject: how do the integration?

From: ghasem

Date: 18 May, 2013 14:10:10

Message: 1 of 3

Hi.
I have a simple question about integral.
I have to calculate following integral and next plot it versus theta.my function is:
f1 = I(z)*sin(theta)*exp(jk*z*cos(theta)
f2 = integral ( f1 , dz)
where:
lower limit of integral : z=0
upper limit of integral : z = 0.7
z= linspace(0,0.7,100);
theta = linspace(0,2*pi,360);
k = a given constant.
I(z) = is a given vector same length with z => length(I(z)) = length(z)
NOW:
I have to plot "f2(theta)" versus "theta" in a polar diagram.
How can I do it?
I used from " f2 = trapz(z,f1)" for integration and next plot "f2" versus "theta".
is there any better method?
thanks...

Subject: how do the integration?

From: Nasser M. Abbasi

Date: 18 May, 2013 20:25:24

Message: 2 of 3

On 5/18/2013 9:10 AM, ghasem wrote:
> Hi.
> I have a simple question about integral.
> I have to calculate following integral and next plot it versus theta.my function is:
> f1 = I(z)*sin(theta)*exp(jk*z*cos(theta)
> f2 = integral ( f1 , dz)

I can't read your f1.

can you try again, and post valid expression. The above
does not even parse. is this exp(j*k*z)*cos(theta) or
exp(j*k*z*cos(theta)) ?

Then you say that z is a vector

z= linspace(0,0.7,100);

then later say that

  I(z) = is a given vector same length with
  z => length(I(z)) = length(z)

May be you can try to write the integral, using normal mathematics
notation. Assume Matlab does not exist. Using just mathematics,
write down the integral you are trying to solve.

If I(z) is supposed to be a vector of numbers, then why not
just say this is a constant C ? or is I(z) a function of z?

If so, what is the definition of this function I(z) ?

--Nasser

Subject: how do the integration?

From: ghasem

Date: 18 May, 2013 23:57:09

Message: 3 of 3

> I can't read your f1.
==========
sorry,f1 is:
f1(z,theta) = I(z)*sin(theta)*exp(jk*z*cos(theta))
==========
> Then you say that z is a vector
> z= linspace(0,0.7,100);
> then later say that
> I(z) = is a given vector same length with
> z => length(I(z)) = length(z)
> is I(z) a function of z?
> If so, what is the definition of this function I(z) ?
==========
yes,I(z) was a function from z (but no explicity).you suppose I have a vector from z and
I(z) that are same size.
in fact I note that I(zi) & k(zi) are correspond with zi , where i=1,2,3,...,length(z);

I have to plot f2 versus theta in polar diagram.
in fact my f2 is as following (I decompose it):

f2(theta) = integral[f1(z1,theta),dz,0,z1]+integral[f1(z2,theta),dz,z1,z2]+...
                integral[f1(z3,theta),dz,z2,z3]+...;
where:
f1(z1,theta)=I(z1)*sin(theta)*exp(jk(z1)*z1*cos(theta))
f1(z2,theta)= I(z2)*sin(theta)*exp(jk(z2)*z2*cos(theta))
...
where:
zi = i*delta_z = i*[0.7/length(z)] i=1,2,3,...,lenght(z)
I(zi) = ith element in vector of value I(z) ; i=1,2,3,...,lenght(z)
k(zi) = ith element in vector of value k ; i=1,2,3,...,lenght(z)
I have all of them.
now,I want to calculate and next plot f2(theta) versus theta.
how integrate from f2(theta) relation and next with theta=linspace(0,2*pi,360) plot it?
for example you suppose we have:
m=100;
z=linspace(0,0.7,m);
real_k = linspace(10,100,m);
imag_k = linspace(1,5,m);
k = real(k)+1j*imag(k);
I = linspace(12,120,m); % I= I(z)
theta = linspace(0,2*pi,360);
NOW,how integrate from f2 relation?

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us