Path: news.mathworks.com!newsfeed-00.mathworks.com!news.kjsl.com!news.glorb.com!news2.glorb.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe03.iad.POSTED!7564ea0f!not-for-mail
From: "Nasser M. Abbasi" <nma@12000.org>
Newsgroups: comp.soft-sys.matlab
References: <hc3956$el9$1@fred.mathworks.com>
Subject: Re: About the element of Matrix in Matlab
Lines: 48
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3598
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350
X-EsetId: 321EA926BF2033386952
X-EsetScannerBuild: 5899
Message-ID: <wS9Fm.48948$Lw1.8356@newsfe03.iad>
NNTP-Posting-Host: ncdeodfefpjopplmihjclpliaacepnnh
X-Complaints-To: abuse@charter.net
X-Trace: ejcgghfdebcllckhadefjppgkgeilljajgmmahmpicjdeoabncdeodfefpjopplmmgdmmdanmgdmojgmdopanbnjcbkjmhmkoeggmpchongebilpkbplbnkeeokkkjchnbbjahdmbpmhjpdc
NNTP-Posting-Date: Mon, 26 Oct 2009 04:48:28 UTC
Date: Sun, 25 Oct 2009 23:48:22 -0500
Xref: news.mathworks.com comp.soft-sys.matlab:579977



"Viet Dang" <muaphongba@yahoo.com> wrote in message 
news:hc3956$el9$1@fred.mathworks.com...
>I have a difficulty in using Matlab to create a matrix. The matrix have its 
>element is a random function of time-varying valuable t such  as Gaussian 
>or Sin. When t changes the matrix is changed and my system will use this 
>matrix to calculate.
>
> My example:
>
> A is a square matrix 3,3.
>
> A(1,1)  = 2 sin(t), A(1,2)=1 sin(t), A(1,3)= 3cos(t).
> A(2,1) = 1 cos(t),A(2,2) = 3sin(t), A(2,3) = 2cos(t).
> A (3,1)= 0.5sin(t),A(3,2) = 1.5sin(t),A(3,3)=3sin(t).
>
> A will be changed when t is running. So how I can matrix A to calculate. 
> Please help me about Matlab code. Thanks.


syms t
A=[2*sin(t)   sin(t)    3*cos(t);
   cos(t)     3*sin(t)  2*cos(t);
   0.5*sin(t) 5*sin(t)  3*sin(t)]

EDU>> for time=1:3
          subs(A,t,time)
      end


    1.6829    0.8415    1.6209
    0.5403    2.5244    1.0806
    0.4207    4.2074    2.5244


    1.8186    0.9093   -1.2484
   -0.4161    2.7279   -0.8323
    0.4546    4.5465    2.7279

    0.2822    0.1411   -2.9700
   -0.9900    0.4234   -1.9800
    0.0706    0.7056    0.4234

etc...

--Nasser