フィルターのクリア

Working out a summation for fitting a curve

1 回表示 (過去 30 日間)
Hashim
Hashim 2022 年 8 月 19 日
コメント済み: Hashim 2022 年 8 月 20 日
Hi, I want to work out a summation that goes as.
I want to fit this to a curve plotted as I on the y axis and t on the x axis using the curve fit app. My function for that goes as:
function I = CurveFitD(t, deltaQ, d)
%CurveFitD We want to fit the I(t)=f(t) to a custom function.
% For a bounded layer we have an expression which can yield us the
% thickness of the polymer layer (in centimeters). We have to fit the transient to this
% equation to calculate the layer thickness.
D = 1e-05;
% deltaQ = 4.2e-11; % Couloumbs
I = zeros(size(t));
for i = 1:length(t)
for k = 1:5
I(i) = I(i) + (-(1)^(k)).*...
(exp((-(k^2).*(d^2))))./(D*t(i));
end
I(i) = sqrt(1./t(i)).*(1+2.*I(i));
end
I = sqrt(D/(pi))*(deltaQ/d).*I;
end
  9 件のコメント
Bruno Luong
Bruno Luong 2022 年 8 月 19 日
編集済み: Bruno Luong 2022 年 8 月 19 日
It looks fine to me. You can also use MATLAB vectorization instead of for-loop:
D = 1e-05;
deltaQ = 4.7e-6;
nmax = 5;
n = (1:nmax)';
t = reshape(t,1,[]);
I = sqrt(D./(pi*t)).*deltaQ/d.*(1 + 2*sum((-1).^n.*exp(-(n*d).^2./(D*t)),1));
Hashim
Hashim 2022 年 8 月 20 日
Thanks everyone!

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by