how to solve exponential equation
Ältere Kommentare anzeigen
Hi everybody
I have got a mat file that I need to use output for the function. Each row of the mat file will be implemented to the function ( 100 of them) and then each result will be saved as one matrix. The code I used did not help. Can anyone help me out?
load('example.mat');
X = sym( nan(size(ee)) );
for K = 1 : numel(ee)
solution = vpasolve( 0.4075*exp(-((x(K)-14.87)/11.39).^2) + 0.5621*exp(-((x(K)-18.64)/27.74).^2, x));
if isempty(solution)
fprintf('No solution for a(%d)\n', K);
else
X(K) = solution;
end
end
The variable ee is coming from the mat file that I loaded.
Thanks!!!
Akzeptierte Antwort
Weitere Antworten (1)
dpb
am 24 Mai 2019
fnE=@(x) 0.4075*exp(-((x-14.87)/11.39).^2) + 0.5621*exp(-((x-18.64)/27.74).^2);
ezplot(fnE,[0 100])
hAx=gca;
hL=hAx.Children;
>> yMx=max(hL.YData)
yMx =
0.9612
>> sum(ee<=yMx)
ans =
0
>> min(ee)
ans =
0.9626
>>
The function maximum is roughly 0.9612; the minimum value in you array is 0.9626; there are no values that will solve the equation given the constants...gets fairly close, but can't quite get there...
>> fminsearch(@(x) -fnE(x),15)
ans =
15.5765
>> fnE(ans)
ans =
0.9612
>>
8 Kommentare
engineer
am 24 Mai 2019
engineer
am 24 Mai 2019
engineer
am 24 Mai 2019
dpb
am 24 Mai 2019
Because there is no x value that will solve either of those two...the max value your equation can have is 0.9612 at x=15.5765 which is what the fminsearch showed (a maximum is a negative minimum).
And, if that is the largest you can get from the equation, unless an ee value is less than or at least equal to that, then there is no solution.
To visualize, added a scatter plot of the ee values and blew up the y axis from the previous ezplot...

Note there's white space below the smallest ee and the maximum of the peak of the functional. Hence, there's no intersection of the two and "never the twain shall meet".
engineer
am 25 Mai 2019
engineer
am 25 Mai 2019
Kategorien
Mehr zu Numeric Solvers finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!