How to get a simplified output answer as a vector columnv from a definite integration loop?

I have this code for definite integration, where it is supposed to give 23 values as an o/p, but instead of giving values in rounded up digits it is giving out huge values unsolved..
function [ Int ] = Integrationoverzones( A,l,m,R,Is,t,Ccell)
%
for i=1:1:size(t)
Intensity = Is*(exp(Ccell/3600)*(50-R));
double Int;
Int = int((Intensity*2*pi*R /A ), l,m);
where Ccell is the column vector input, and my outputs look like this : (10396344664475805277532160*pi)/4958531319053791 all the 20+ values, Please help.

2 Comments

Please use code formatting as explained in the "Markup help" link on this page. I've done the formatting for you this time.
Thanks Jan. But turns out matlab cnat do this analytically, I used the two for loops for it..

Sign in to comment.

 Accepted Answer

What do you expect as result of this line:
double Int;
In C this line would declare the type of Int as a DOUBLE. But in Matlab the smart automatic parsing converts this to:
double('Int');
The string 'Int' is converted to a double vector [73, 110, 116] and its output is suppressed due to the semicolon. I assume you want to convert the contents of the variable Int to a double:
Int = int((Intensity*2*pi*R /A ), l,m);
disp(double(Int));

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Asked:

on 25 Oct 2011

Community Treasure Hunt

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

Start Hunting!