Finding the max value of a function containing an integral
Show older comments
I have been trying to find the value of "v" for the max value of "fun2". So my question is, how should I do this?
clear all;
close all;
clc;
k = 1.38e-23;
q = 1.60e-19;
h = 6.626e-34;
c = 3e+8;
R = 0;
T = 300;
Emin = 1.34;
x=0;
E = 8;
G = 2.187e+21;
% counter = 1;
% vstep = 0;
% Jstep = 0;
% Nstep = 0;
%P = 0;
%J = 0.01;
v = 0;
Eqmin= Emin*q;
Eq = E*q;
Const = (2*pi)/(h^3*c^2);
fun = @ (x) exp((q*v-x)./(k*T)).*x.^2;
fun2 = @(v) v*q(G-Const*(integral(fun,Eqmin,Eq)));
v0 = [0];
[v,fval] = fmincon(fun2,v0,[],[],[],[],[],[],[],[])
Accepted Answer
More Answers (0)
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!