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!