|
"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
|