×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

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

Matrix with element that change with 'for loop'

Matrix with element that change with 'for loop'

Matrix with element that change with 'for loop'

(OP)
Hello every body
I am working on a project that I need to find matrix similar to this one
% Beginning of the Code
clear all;close all;clc;
for m=1:10
A11(m)=m+1;
B11(m)=2*m;
D11(m)=2*m+1;
abd=[A11(m) B11(m);B11(m) D11(m)];
end
%End of the Code
where I want the matrix 'abd' get different value for each value of 'm' ,in the code above I only get the value at m=10;and if I use abd(m) it won't be right since in that form it just indicates the element.so please help and suggestions.
Replies continue below

Recommended for you

RE: Matrix with element that change with 'for loop'

(OP)
No it is not the same thing for the matrix abd; I was looking for the answer of that.I got some help from someone and it seems that I need to define abd(:,:,m)not just abd(m)and to make the code run faster I need to use prelocatting abd=zeros(2,2,101) where m=1:101.

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



News


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