how do i write code for following equation

l=4
d=[10:10:100]*10^-6;
D=100*10^-12;
m=10^4;
t1=d^2/6*D ;
t=t1 + (i-1)*Tp;
I'm confusing about time t,what is the value of t and length of t,c(t) and s(t)

回答 (2 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 1 月 2 日
編集済み: KALYAN ACHARJYA 2020 年 1 月 2 日

0 投票

l=4;
d=(10:10:100)*10^-6;
D=100*10^-12;
m=10^4;
t1=(d.^2)./(6*D);
Tp=? %% Define Tp
t=t1+(i-1)*Tp;
e1=(4*pi*D*t).^(3/2);
e2=-d.^2./(4*D.*t);
c_t=(m./e1).*exp(e2)
For summation s(t), please see here

4 件のコメント

AJIT KUMAR
AJIT KUMAR 2020 年 1 月 2 日
i'm really sorry .Here Tp=30s
AJIT KUMAR
AJIT KUMAR 2020 年 1 月 2 日
編集済み: Walter Roberson 2020 年 1 月 3 日
Actally i'm confused about value and length of t.when write code for t
i got
t=[1.201666666666667e+02,1.506666666666667e+02,1.815000000000000e+02,2.126666666666667e+02,2.441666666666667e+02,276,3.081666666666667e+02,3.406666666666667e+02,3.735000000000000e+02,4.066666666666667e+02]
and also what wll be the length of c(t) and s(t)
KALYAN ACHARJYA
KALYAN ACHARJYA 2020 年 1 月 2 日
yes here t represents
t=t1+(i-1)*Tp;
Rest code with Tp
l=4;
d=(10:10:100)*10^-6;
D=100*10^-12;
m=10^4;
t1=(d.^2)./(6*D);
Tp=30;
t=t1+(i-1)*Tp;
e1=(4*pi*D*t).^(3/2);
e2=-d.^2./(4*D.*t);
c_t=(m./e1).*exp(e2) % This the result for c(t) as an array
AJIT KUMAR
AJIT KUMAR 2020 年 1 月 6 日
sorry to say that but i'm not satisfied with your answer.ok i'm giving the code if there is anything wrong plz suggest some correction.
Thank u
m = 10^6; D = 100*10^-12; d = [10*10^-6:10*10^-6:100*10^-6];
r = 10*10^-6; Tp = 30;
l = 4;b = 0;L = 10;c=[];
%s=zeros();
s_diff_sum_i=zeros();g_d=zeros();g_diff_sum=zeros();si=[];
%i =l+1:L+l ;
% syms j;
%
for k=1:length(d)
ts = (d(k).^2)./(6.*D);
ti=l*Tp:Tp:(L+l-1)*Tp ;
t1 = ts +ti; s3=0;
for j=0:4
c_temp = (m./(4.*pi.*D.*(t1+j*Tp )).^3/2).*exp(-(d(k).^2)./(4.*D.*(t1+j*Tp )));
c=[c c_temp];
s=sum(c_temp);
s1=sum(c);
s2=s2+c_temp;
end
s3(k)=s;
s4(k)=s1;
end

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

AJIT KUMAR
AJIT KUMAR 2020 年 1 月 3 日

0 投票

i have already written the code for these equation but i'm confused about output of t,s(t).if u don't mind please give me the output of t as well as s(t).i used "for loop" for t as well as for s(t).so tell me may i use "for loop "for t or not?.Any help is much appriciated.Thanks

5 件のコメント

Walter Roberson
Walter Roberson 2020 年 1 月 3 日
The length of s_t is the same as the length of c_t, which is the same as the length of d.
What would you use a for loop to do? t is not an input to this, t is an output from this.
I think you need to rethink your c and s . I do not think they should be arrays: I think they should be functions that take an input, t, and compute an output that is the same size.
You are currently computing t, and I do not think you should be. It does not make sense to do so when you have that there. Your definition of needs to be understood not as a formula for a specific t, and instead as a formula relating the dummy input value, referred to as t, to an output value.
Your d is currently a vector, and I don't think it should be: I think it very likely should be a scalar, and that there should not be any relationship between d and t.
AJIT KUMAR
AJIT KUMAR 2020 年 1 月 3 日
i agree with your point .if i don't use for loop for t then what should i do.could u tell me,because there is two thing to calculate
(1). t
(2).s(t)
for every t there is s(t).yes you can tell there is no relation between d and i rather than t and d because t depends on ts and ts depends on d.
Walter Roberson
Walter Roberson 2020 年 1 月 6 日
If t depends upon ts and ts depends upon d, then you are not using the same equations that you posted the latex for, and there is no way for us to assist you. Your call in defining is not possible if your t in defining depends upon ts and ts depends upon d.
AJIT KUMAR
AJIT KUMAR 2020 年 1 月 6 日
m = 10^4; D = 100*10^-12; d = [10*10^-6:10*10^-6:100*10^-6];
r = 10*10^-6; Tp = 30;
l = 4;L = 10;c=[];
for k=1:length(d)
t1 = (d(k).^2)./(6.*D);
ti=l*Tp:Tp:(L+l-1)*Tp ; %%here i=l+1:L+l and ti=(i-1)*Tp
t= t1 +ti;
s3=0;
for j=0:4
c_temp = (m./(4.*pi.*D.*(t+j*Tp )).^3/2).*exp(-(d(k).^2)./(4.*D.*(t+j*Tp )));
c=[c c_temp];
s=sum(c_temp);
s1=sum(c);
s2=s2+c_temp;
end
s3(k)=s;
s4(k)=s1;
end
so,plz suggest me. should i use for loop for t and at final stage may i calculate sum(c) or sum(c_temp) .i shall be gratefull if u reply
Thank u
Walter Roberson
Walter Roberson 2020 年 1 月 6 日
I have no opinion on that matter, as I do not know what equations you are implementing. All I know is that you are not implementing the equations that were posted in your Question.

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

カテゴリ

タグ

質問済み:

2020 年 1 月 2 日

コメント済み:

2020 年 1 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by