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)

Respuestas (2)

KALYAN ACHARJYA
KALYAN ACHARJYA el 2 de En. de 2020
Editada: KALYAN ACHARJYA el 2 de En. de 2020
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 comentarios

AJIT KUMAR
AJIT KUMAR el 2 de En. de 2020
i'm really sorry .Here Tp=30s
AJIT KUMAR
AJIT KUMAR el 2 de En. de 2020
Editada: Walter Roberson el 3 de En. de 2020
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)
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
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

Iniciar sesión para comentar.

AJIT KUMAR
AJIT KUMAR el 3 de En. de 2020

0 votos

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 comentarios

Walter Roberson
Walter Roberson el 3 de En. de 2020
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 el 3 de En. de 2020
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 el 6 de En. de 2020
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.
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 el 6 de En. de 2020
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.

Iniciar sesión para comentar.

Categorías

Etiquetas

Preguntada:

el 2 de En. de 2020

Comentada:

el 6 de En. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by