|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
<P>Matlab Basics and Some useful coding for OFDM simulator design </P>
<P>Task 1. Execute the following commands in matlab command line and attach the detail explanation to what happens in each execution. </P>
<P>1. Scalar Calculation <br> >> A=10 % A is a scalar whose value is equal to 10.<br> >> A=4;<br> >> B=10;<br> >> A<br> >> A+B<br> >> A=2;B=5;C=A+5</P>
<P>Vector Calculation<br>>>B=1:5 <br> >>B=[2 1 4 3] <br>>>B=-4:2:6 <br> >>A=[1:4];B=[3 2 5 6];C=A+B;<br> >>A<br> >>B<br>>>C<br>>> who<br>>> whos<br>>> clear<br>>> who</P>
<P>Matrix manipulation<br>>>A=[ 2 1 3; 4 5 6; 7 2 3] <br>>>B=[1:3]<br> >>C=[3 2 5 ]<br> >> B’<br> >> C’<br> >> D=B’;E=C’;<br> >>F=[D E]<br> >>G=[C’ B’] <br> >>H=F-G<br> >> H=F+G<br>>> H=F.*G<br> >> H=F./G<br> >> H=F*G<br> >> H=A*F<br> >> H=A.^2<br>>> H=F.^2<br>>> H=A^2<br>>> H=F^2<br>>> H=2.^B<br>>> H=2.^C<br>>> H=G.^2 +3*F+G <br><br>Matrix(Vector) manipulation<br>>> A=[3 4 1 2 4];<br>>> A(1)<br>>> A(2)<br>>> A(3)<br>>>B=A(2:4)<br>>>B=A(1:4)<br>>> A=rand(8,5)<br>>> help rand<br>>> A<br>>> A(2,4)<br>>> A(8,5)<br>>> A(1,:)<br>>> B=A(4,:)<br>>> A(:,1)<br>>> A(:,5)<br>>> C=A(2:4,:)<br>>> D=A(:,[1 3 5]);<br>>> max(A)<br>>>[T1 T2]=max(A)<br>>> mean(A)<br>>> max(mean(A))<br>>> max(max(A))<br>>> A=rand(2,2); <br>>> inv(A)<br>>> help inv<br>>>A^(-1)</P>
<P>Basic Math functions and plot<br>>> A=0:3<br>>> B=2.^A<br>>> log2(B)<br>>> x=0:0.1:10; y=sin(x); <br>>> plot(x)<br>>> plot(y)<br>>> figure<br>>> plot(x,y)<br>>> y2=cos(x);<br>>> y3=[y’ y2’]<br>>> plot(x, y3)<br>>> axis([0 20 -2 2])<br>>> help plot<br>>> help axis<br><br>Task 2. Follow the following procedures and execute the mfile (matlab script file). Give the detail explanation for each line.</P>
<P>1). Edit the following subscript file by using matlab editor and save it with your own filename “***.m”</P>
<P>clear<br>x=0:0.1:10;<br>for t=1:8<br> a=t/10;<br> if (a==0.6)<br> a=0.62;<br> end<br> y(t,:)=x.*sin(a*x);<br>end <br>plot(x,y)<br>xlabel('x')<br>ylabel('y=x sin (ax)')<br>legend( 'a=0,1', 'a=0.2', 'a=0.3', 'a=0.4', 'a=0.5', 'a=0.62', 'a=0.7', 'a=0.8')</P>
<P>2).At the matlab command line, execute script file by typing as follows<br>>> bbiriri<br>.</P>
<P>Task 3. Following are some useful matlab coding examples for OFDM system design. Execute the following commands or script (m-file) and attach the detail explanation to each line.</P>
<P>sine wave form generation<br>Ts=2;<br>step=0.001;<br>t=0:step:Ts;<br>Ns=10;<br>for n=1:16<br> sub_carrier(n,:)=exp(j*2*pi*n*t);<br>end<br>plot(t, real(sub_carrier))<br><br><br>Numerical integration : you can numerically calculate an integration of an arbitrary function over interval [a b]. This will be required for OFDM demodulation </P>
<P>%Example integration 1/(x^2+1) over [-2 4], You will get S equal to the integration result.</P>
<P>step=0.001;<br>a=-2;<br>b=4;<br>x=a:step:b;<br>ft=1./(x.^2 +1);<br>S= sum(ft)*step;</P>
<P><br>Vector(or matrix) concatenation) : will be required for Guard time insertion and OFDM symbol concatenation <br> a=[1 2 4];<br> b=[4 5 6];<br> c=[a b]<br> <br>convolution : will be required for channel modeling <br>ht=[ 1 2 3 2 1];<br>xt=[ 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0.5 0 0];<br>yt=conv(xt,ht)<br>plot(yt)<br></P>
[此贴子已经被aspen于2006-5-22 20:34:30编辑过]
|
|