Help with Integral and MATLAB Equation using Real Numbers

Click For Summary
SUMMARY

The discussion centers on optimizing a MATLAB code used for analyzing a physics experiment involving Bessel functions and exponential decay. The user seeks assistance in normalizing large constants, specifically the number "5500000", to improve the realism of the results. The goal is to modify the equation so that the exponential component, defined by the parameters 'a' and 'N', effectively determines the number of rings in the output. The user is encouraged to provide more context about the physical problem being analyzed for more targeted help.

PREREQUISITES
  • Familiarity with MATLAB programming (version unspecified)
  • Understanding of Bessel functions and their applications in physics
  • Knowledge of exponential functions and normalization techniques
  • Basic concepts of numerical integration in MATLAB
NEXT STEPS
  • Research normalization techniques for large constants in mathematical modeling
  • Learn about MATLAB's numerical integration methods, such as 'integral' or 'trapz'
  • Explore the implications of Bessel functions in physical systems
  • Investigate how to parameterize equations to control output characteristics, such as the number of rings
USEFUL FOR

Researchers and students in physics, MATLAB programmers, and anyone involved in numerical modeling and simulation of physical phenomena.

Lemenks
Messages
14
Reaction score
0
I carried out a physics experiment and I wanted to analysis the problem with matlab. I have some code in MATLAB that "works" as in it gives ok result but the numbers used are quite nonsensical, I need help making the reworking the equation with real numbers. I am not sure if this is the correct thread, if not sorry. Here is my code:

Matlab:
format long;
clear all;

I0=39546.95973;
i=sqrt(-1);
r=0.0;
fid=fopen('plot.txt','w')  %Êý¾ÝдÔÚplot.txt
for m=1:300
    p(m)=m*0.0001-0.015;   %¿ÉÒÔµ÷Õû×÷ͼ²½³¤
    In(m)=0;
    dddr=0.00001;
    for r=0.0:dddr:0.010   %¸ù¾ÝÊÕÁ²ÐÔµ÷Õû»ý·ÖÉÏÏ޺Ͳ½³¤
        In(m)=In(m)+r*besselj(0,5500000*r*p(m))*exp(-4.325259515570934*10^6*r*r)*exp(-i*(5500000*r*r-27.014528191562999*exp(-4.325259515570934*10^6*r*r)));
    end
    I(m)=3.025*10^13*dddr^2*I0*(norm(In(m)))^2;
    fprintf(fid,'%9.4f  %9.4f  \n',p(m),I(m));
end
fclose(fid)
fclose all;
hold off
    plot(p,I);  %»Í¼
hold on
return;

My main problem is using very large numbers like "5500000". What I would like to do, is make the exp(a*exp(b*r^2)) component be the part of the function that determines the number of rings, where a=2Npi and N would determine the number of rings. However I am not sure how to go about normalizing the rest of the constants so that this would be the case.

Mod note: I added code tags. Please do that every time you post code.
 
Physics news on Phys.org
You will have to give more details. What physical problem are you looking at? What is the code actually doing?
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 9 ·
Replies
9
Views
5K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 41 ·
2
Replies
41
Views
10K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K