Why won't this function work properly?

function [EnergyReleased] = energy(mass)
%The energy function takes in a mass of Pu-239 and outputs the energy released
%from the fission of Pu-239.
%This function uses simple dimensional analysis to convert MeV released
%from a standard fission to Joules released from various masses of Pu-239.
%First, the function takes 200 MeV, the standard energy released for one
%fission, per 239.052 amu for Pu-239. Then, it multiplies that by the
%conversion factor 1.602*10^-13 Joules per 1 MeV. Now we are in J/amu.
%Finally, the function takes 1 amu divided by the mass you input (in
%GRAMS). This will now yield Joules per GRAM.
EnergyReleased = ((200/239.052) * (1.602*(10^(-13))) * (1/mass));
end

5 Kommentare

Walter Roberson
Walter Roberson am 11 Feb. 2018
What difficulty are you encountering?
Elizabeth Jurgensen
Elizabeth Jurgensen am 11 Feb. 2018
Matlab is telling me there is an error in the line "EnergyReleased = ((200/239.052) * (1.602*(10^(-13))) * (1/mass));" There is no description of the error, it simply says "Error in line 105".
Geoff Hayes
Geoff Hayes am 11 Feb. 2018
Elizabeth - what is the value for mass? There should be more to the error message than just "error in line 105". Is this function part of a large file and you have just provided a subset of the code?
Roger Stafford
Roger Stafford am 11 Feb. 2018
There seems something fishy with your formula in going from joules/amu over to total joules. Assuming that “200/239.052*1.602*10^(-13)” is valid for joules per atomic mass unit, you need to multiply by the amu per gram factor which I believe is something like 1/(1.67377*10^-24). And then you need to multiply, not divide, by the entered mass in grams - the more grams, the more energy released.
Walter Roberson
Walter Roberson am 11 Feb. 2018
If you are using a vector for mass then you would need the ./ operator instead of /

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

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

Gefragt:

am 11 Feb. 2018

Kommentiert:

am 11 Feb. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by