how to solve exponential equation
显示 更早的评论
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!!!
采纳的回答
更多回答(1 个)
dpb
2019-5-24
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 个评论
engineer
2019-5-24
engineer
2019-5-24
engineer
2019-5-24
dpb
2019-5-24
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
2019-5-25
engineer
2019-5-25
类别
在 帮助中心 和 File Exchange 中查找有关 Numeric Solvers 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!