Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

divided fixed distance to the parts and after divided each part to parts with some condition

1 vue (au cours des 30 derniers jours)
abbas hasan
abbas hasan le 29 Jan 2013
Clôturé : MATLAB Answer Bot le 20 Août 2021
hi everybody i start work with MATLAB from short time and i need yours helps, i try to write code first divided fixed distance to the fixed number of parts according to the some condition , after divided each part to the sub parts with some condition. first i defined some parameter used in the calculation:
D=40 the distance lambda=0.6328 j=3 the number of divided , i.e here i real want to divided D to 6 parts , 3 not equal parts in each half distance (D/2) but the size of parts in each sides of D/2 is symmetric with second sides for more explain suppose i divided the distance from 0 to 20 to three parts 5,7,8 and distance from 20 to 40 to three parts 8,7,5 for example.
first calculate some parameter f used after to determined the width of each parts
f=(D^2)/(8*j*lambda)
and second parameter is r which find from the relation
r(j)= sqrt(2*lambda*f*j) in the end find the width of each parts which named w from the relation w=diff(r) w=[r(1) w] so this step give me the width of each parts to this point my code is work but i need to make loop to divided each parts (w) to sub parts end for this point first determined some parameter used after to divided each parts so we find f1 for each parts w first from the relation f1(j)=((w(j)*2)^2)/(8*jj*lambda) here jj represent the number of sub parts i wanted to divided each parts i write this code to divided first the half of distance D=40 to 3 parts and after divided each parts to 4 sub parts but i would like to generalized this code to work with any number i want to divided each distance and each parts in this distance my code is:
D=40;
lambda=0.6328;
j=3;
f=((D^2)/(8*j*lambda));
jj=4;
for j=1:3
for jj=1:4
r(j)=sqrt(2*lambda*f*j); % this part of code to divided the half of
w=diff(r); % the distance to three parts
w=[r(1) w];
f1(j)=((w(j)*2)^2)/(8*jj*lambda);
r1(jj)=sqrt(2*lambda*f1(1)*jj); % this part of code to divided the first
w1=diff(r1); % part to 4 sub parts
w1=[r1(1) w1];
end
end
for jj=1:4
r2(jj)=sqrt(2*lambda*f1(2)*jj); % this part of code to divided the
w2=diff(r2); % second part to 4 sub parts
w2=[r2(1) w2];
end
for jj=1:4
r3(jj)=sqrt(2*lambda*f1(3)*jj); % this part of code to divided the
w3=diff(r3); % third parts to 4 sub parts
w3=[r3(1) w3];
end
thanks for any helps

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by