×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

D' structure from D structure calculating.

D' structure from D structure calculating.

D' structure from D structure calculating.

(OP)
Hello,
It is about programming on matlab. I have a structure of D elements with their indexes and their values. I want from this structure to calculate a new quantity D'.

For indexes i=1 to p=6, it is simple: D'_i = D_i.

For _i_j_k...to p , it is more complicated. D'_i_j_k...to p = D_i_j_k...to p - sum All D_i_j_k...to p-1 - sum All D_i_j_k - sum All D_i_j - sum All D_i.
It is better to see these three examples to understand:


D'_1_4 = D_1_4 - D_1 -D_4

D'_1_3_5 = D_1_3_5 - D_1_3 - D_1_5 - D_3_5 - D_1 - D_3 - D_5

D’_1_2_3_4_5_6 = D_1_2_3_4_5_6 – (D_1_2_3_4_5 + D_1_2_3_4_6 + D_1_2_3_5_6 + D_1_2_4_5_6 + D_1_3_4_5_6 + D_2_3_4_5_6)- (D_1_2_3_4 + D_1_2_3_5- D_1_2_3_6 + D_2_3_4_5 + D_2_3_4_6 + D_3_4_5_6 )- (D_1_2_3 + D_1_2_4 + D_1_2_5 + D_1_2_6 + D_2_3_4 + D_2_3_5 + D_2_3_6+ D_3_4_5 + D_3_4_6 ) – (D_1_2 + D_1_3 + D_1_4 + D_1_5 + D_1_6 + D_2_3 + D_2_4 + D_2_5 + D_2_6 + D_3_4 + D_3_5 + D_3_6 + D_4_5 + D_4_6) – ( D_1 + D_2 + D_3 + D_4 + D_5+ D_6)

I hope get a new structure r' which is the same bu with D'_. Thanks before.


r =
struct with fields:
D_1: 79.3927
D_2: 141.8463
D_3: -126.6688
D_4: 167.2028
D_5: 547.2340
D_6: 10.5369
D_1_2: 98.8763
D_1_3: -140.9858
D_1_4: 95.0552
D_1_5: 458.3821
D_1_6: -48.7647
D_2_3: -107.6000
D_2_4: 170.8630
D_2_5: 409.5086
D_2_6: 54.4450
D_3_4: -128.2986
D_3_5: 798.2442
D_3_6: -157.5395
D_4_5: 543.9655
D_4_6: 41.6689
D_5_6: 326.9267
D_1_2_3: -112.3449
D_1_2_4: 116.5339
D_1_2_5: 366.5535
D_1_2_6: 0.8760
D_1_3_4: -140.3052
D_1_3_5: 752.5296
D_1_3_6: -175.7908
D_1_4_5: 480.4113
D_1_4_6: -36.4595
D_1_5_6: 249.4541
D_2_3_4: -95.5353
D_2_3_5: 754.1615
D_2_3_6: -138.5796
D_2_4_5: 433.9207
D_2_4_6: 69.7545
D_2_5_6: 204.5355
D_3_4_5: 794.4483
D_3_4_6: -159.0863
D_3_5_6: 156.7859
D_4_5_6: 326.2838
D_1_2_3_4: -106.1654
D_1_2_3_5: 706.7515
D_1_2_3_6: -156.7492
D_1_2_4_5: 390.2635
D_1_2_4_6: 32.4656
D_1_2_5_6: 168.7679
D_1_3_4_5: 752.4031
D_1_3_4_6: -174.2566
D_1_3_5_6: 135.9873
D_1_4_5_6: 268.3483
D_2_3_4_5: 763.9713
D_2_3_4_6: -124.6966
D_2_3_5_6: 104.4331
D_2_4_5_6: 221.9732
D_3_4_5_6: 166.1050
D_1_2_3_4_5: 712.0376
D_1_2_3_4_6: -148.4679
D_1_2_3_5_6: 81.4154
D_1_2_4_5_6: 189.4950
D_1_3_4_5_6: 135.4077
D_2_3_4_5_6: 114.0186
D_1_2_3_4_5_6: 86.0936

RE: D' structure from D structure calculating.

See the following example on how to automate the process:

CODE --> MATLAB

r.D_1= 79.3927;
r.D_2= 141.8463;
r.D_3= -126.6688;
r.D_4= 167.2028;
r.D_5= 547.2340;
r.D_6= 10.5369;
r.D_1_2= 98.8763;
r.D_1_3= -140.9858;
r.D_1_4= 95.0552;
r.D_1_5= 458.3821;
r.D_1_6= -48.7647;
r.D_2_3= -107.6000;
r.D_2_4= 170.8630;
r.D_2_5= 409.5086;
r.D_2_6= 54.4450;
r.D_3_4= -128.2986;
r.D_3_5= 798.2442;
r.D_3_6= -157.5395;
r.D_4_5= 543.9655;
r.D_4_6= 41.6689;
r.D_5_6= 326.9267;

for i=1:6
    str1=['D_',num2str(i)];
    rnew.(str1)=r.(str1);
end
for i=1:6
    for j=i+1:6
        str1=['D_',num2str(i),'_',num2str(j)];
        rnew.(str1)=r.(str1) - r.(str1([1,2,3])) - r.(str1([1,4,5]));
    end
end 

Best regards,

George Papazafeiropoulos

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close