Filter löschen
Filter löschen

plot Bethe-Bloch equation

29 Ansichten (letzte 30 Tage)
Jeroen
Jeroen am 27 Feb. 2012
Kommentiert: Kunal Kumar am 25 Mai 2021
Dear people,
For a project I have to plot the Bethe-Bloch equation. That is this equation: dedx = (-K*z^2*Z)/(A*beta2)*(0.5*log((2*me*1*10^9*beta2.*gamma2.*Tmax)/I^2)-beta2);
Every time i want to run the program it says the matrix dimension must agree. i do not know what i am doing wrong. I am trying this since the morning and I would like to move on. The only thing that chances is the eng. This has to run from 0 to 0.5 GeV.
clc; clear; z = 1; re = 2.817*10^-15; Z = 29; A = 63.546; Na = 6.022*10^23; mp = 0.93827231; %GeV eng = 0.001:0.001:0.5; %GeV gamma = (eng + mp)/mp; gamma2 = gamma.*gamma; beta = (1.0 - (1.0/(gamma2)')).^0.5; beta2 = beta.*beta; me = 0.51*10^-3; c = 3*10^8; I = 10*Z; K = 4*pi*Na*re^2*me*c^2;
Tmax = (2.0 * me*1e9*beta2'*gamma2)/(1.0 + (2.0*gamma*(me/mp) + (me/mp)^2)); Tmax = Tmax';
dedx = (-K*z^2*Z)/(A*beta2)*(0.5*log((2*me*1*10^9*beta2.*gamma2.*Tmax)/I^2)-beta2);
figure; plot(eng,dedx);
  3 Kommentare
Jeroen
Jeroen am 27 Feb. 2012
clc;
clear;
z = 1;
re = 2.817*10^-15;
Z = 29; A = 63.546;
Na = 6.022*10^23;
mp = 0.93827231; %GeV
eng = 0.001:0.001:0.5; %GeV
gamma = (eng + mp)/mp;
gamma2 = gamma.*gamma;
beta = (1.0 - (1.0/(gamma2)')).^0.5;
beta2 = beta.*beta;
me = 0.51*10^-3;
c = 3*10^8;
I = 10*Z;
K = 4*pi*Na*re^2*me*c^2;
Tmax = (2.0 * me*1e9*beta2'*gamma2)/(1.0 + (2.0*gamma*(me/mp) + (me/mp)^2));
Tmax = Tmax';
dedx = (-K*z^2*Z)/(A*beta2)*(0.5*log((2*me*1*10^9*beta2.*gamma2.*Tmax)/I^2)-beta2);
figure;
plot(eng,dedx);
Kunal Kumar
Kunal Kumar am 25 Mai 2021
Jeroen, I am having this same problem. Can you help me with the code. I tried running your code but it shows error. Can you share the code that ran on MATLAB.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Grzegorz Knor
Grzegorz Knor am 27 Feb. 2012
Use .* (the element-by-element product) operator for array multiplication.
  3 Kommentare
Grzegorz Knor
Grzegorz Knor am 27 Feb. 2012
The same for division: ./
I've checked, and it works.
Jeroen
Jeroen am 27 Feb. 2012
Okay thank you. It works now!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Particle & Nuclear Physics finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by