I am trying to create the following function in MATLAB to be used for plotting (see image)
Here is the function I have:
function M = diodeMultiplication(alpha, beta, x, w)
M = (exp(-int(alpha-beta,x,w)))./(1-(int(alpha.*exp(-int(alpha-beta,diff(x),w)),0,w));
end
Where x is a constant (I.e. x = 0) and w is a constant (I.e. w = 1.*10^-4) and alpha and beta are arrays of floating point values that are functions of E.
I would like to input alpha,beta, x and w and plot E vs M. which would look something like this:
plot(E, diodeMultiplication(alpha, beta, x, w));
This function will not run. Does anyone have any input?
you want to do a numerical integration, so use integral
instead of int
.
You will also need to define alpha
and beta
as functions to do so. This is done by just giving alpha
as the function that computes the array you mentioned, e.g. if alpha=E.^2
then instead of that, you input alpha=@(x)(x.^2)
to integral
.