フィルターのクリア

Syms equation in GUI to @ equation solver

2 ビュー (過去 30 日間)
Martin Maurel
Martin Maurel 2021 年 3 月 12 日
コメント済み: Martin Maurel 2021 年 4 月 14 日
Hello, I write a GUI on Matlab 2020 with all the Toolbox, but need to work also on a Matlab 2007 without all the Toolbox.
Currently I use :
function [dt] = DeltaT(lambda0,c,deltaLambdaSPM,tfwhm)
dtlim=lambda0/2/c %% lower limit
syms x
A=c*lambda0*2*x/(2*c*x-lambda0);
B=c*lambda0*2*x/(2*c*x+lambda0);
C=A-B;
eqn=C==7*deltaLambdaSPM;
varLimits(1,1) = dtlim;
varLimits(2,1)=tfwhm/5 ;
S = vpasolve([eqn],x,varLimits);
dt=double(S);
end
With Matlab 2020 + Toolbox it's working, not with the other.
So I try to modify it
lambda0=1030e-9;
c=3e8;
tfwhm=500e-15;
deltaLambdaSPM=1.35e-06;
dtlim=lambda0/2/c;
fun = @(x) c*lambda0*2*x./(2*c*x-lambda0)- c*lambda0*2*x./(2*c*x+lambda0) - 7*deltaLambdaSPM
x0 = [dtlim tfwhm/5];
z = fzero(fun,x0)
%%
Error using fzero (line 229)
Function values at interval
endpoints must be finite and
real.
Error in testesuationsolver
(line 17)
z = fzero(fun,x0)
I try also fsolve...
solution should be : 1.9e-15
If someone have an idea?
Regards
  2 件のコメント
Asvin Kumar
Asvin Kumar 2021 年 3 月 15 日
fzero(dtlim) is Inf.
Martin Maurel
Martin Maurel 2021 年 4 月 14 日
Your are right,
x0 = [1.00000001*dtlim tfwhm/5];
solve it

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeNumeric Solvers についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by