紧急求救(各位大侠请帮帮忙)
楼主 · 1 楼
Matlab Basics and Some useful coding for OFDM simulator design
Task 1. Execute the following commands in matlab command line and attach the detail explanation to what happens in each execution.
1. Scalar Calculation
>> A=10 % A is a scalar whose value is equal to 10.
>> A=4;
>> B=10;
>> A
>> A+B
>> A=2;B=5;C=A+5
2. Vector Calculation
>>B=1:5
>>B=[2 1 4 3]
>>B=-4:2:6
>>A=[1:4];B=[3 2 5 6];C=A+B;
>>A
>>B
>>C
>> who
>> whos
>> clear
>> who
3. Matrix manipulation
>>A=[ 2 1 3; 4 5 6; 7 2 3]
>>B=[1:3]
>>C=[3 2 5 ]
>> B’
>> C’
>> D=B’;E=C’;
>>F=[D E]
>>G=[C’ B’]
>>H=F-G
>> H=F+G
>> H=F.*G
>> H=F./G
>> H=F*G
>> H=A*F
>> H=A.^2
>> H=F.^2
>> H=A^2
>> H=F^2
>> H=2.^B
>> H=2.^C
>> H=G.^2 +3*F+G
4. Matrix(Vector) manipulation
>> A=[3 4 1 2 4];
>> A(1)
>> A(2)
>> A(3)
>>B=A(2:4)
>>B=A(1:4)
>> A=rand(8,5)
>> help rand
>> A
>> A(2,4)
>> A(8,5)
>> A(1,:)
>> B=A(4,:)
>> A(:,1)
>> A(:,5)
>> C=A(2:4,:)
>> D=A(:,[1 3 5]);
>> max(A)
>>[T1 T2]=max(A)
>> mean(A)
>> max(mean(A))
>> max(max(A))
>> A=rand(2,2);
>> inv(A)
>> help inv
>>A^(-1)
5 Basic Math functions and plot
>> A=0:3
>> B=2.^A
>> log2(B)
>> x=0:0.1:10; y=sin(x);
>> plot(x)
>> plot(y)
>> figure
>> plot(x,y)
>> y2=cos(x);
>> y3=[y’ y2’]
>> plot(x, y3)
>> axis([0 20 -2 2])
>> help plot
>> help axis
Task 2. Follow the following procedures and execute the mfile (matlab script file). Give the detail explanation for each line.
1). Edit the following subscript file by using matlab editor and save it with your own filename “***.m”
clear
x=0:0.1:10;
for t=1:8
a=t/10;
if (a==0.6)
a=0.62;
end
y(t,:)=x.*sin(a*x);
end
plot(x,y)
xlabel('x')
ylabel('y=x sin (ax)')
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')
2).At the matlab command line, execute script file by typing as follows
>> bbiriri
.
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.
sine wave form generation
Ts=2;
step=0.001;
t=0:step:Ts;
Ns=10;
for n=1:16
sub_carrier(n,:)=exp(j*2*pi*n*t);
end
plot(t, real(sub_carrier))
Numerical integration : you can numerically calculate an integration of an arbitrary function over interval [a b]. This will be required for OFDM demodulation
%Example integration 1/(x^2+1) over [-2 4], You will get S equal to the integration result.
step=0.001;
a=-2;
b=4;
x=a:step:b;
ft=1./(x.^2 +1);
S= sum(ft)*step;
Vector(or matrix) concatenation) : will be required for Guard time insertion and OFDM symbol concatenation
a=[1 2 4];
b=[4 5 6];
c=[a b]
convolution : will be required for channel modeling
ht=[ 1 2 3 2 1];
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];
yt=conv(xt,ht)
plot(yt)
每个小题都有不同的要求,所以更加困难,而且是全英文。各位清帮帮忙。
Task 1. Execute the following commands in matlab command line and attach the detail explanation to what happens in each execution.
1. Scalar Calculation
>> A=10 % A is a scalar whose value is equal to 10.
>> A=4;
>> B=10;
>> A
>> A+B
>> A=2;B=5;C=A+5
2. Vector Calculation
>>B=1:5
>>B=[2 1 4 3]
>>B=-4:2:6
>>A=[1:4];B=[3 2 5 6];C=A+B;
>>A
>>B
>>C
>> who
>> whos
>> clear
>> who
3. Matrix manipulation
>>A=[ 2 1 3; 4 5 6; 7 2 3]
>>B=[1:3]
>>C=[3 2 5 ]
>> B’
>> C’
>> D=B’;E=C’;
>>F=[D E]
>>G=[C’ B’]
>>H=F-G
>> H=F+G
>> H=F.*G
>> H=F./G
>> H=F*G
>> H=A*F
>> H=A.^2
>> H=F.^2
>> H=A^2
>> H=F^2
>> H=2.^B
>> H=2.^C
>> H=G.^2 +3*F+G
4. Matrix(Vector) manipulation
>> A=[3 4 1 2 4];
>> A(1)
>> A(2)
>> A(3)
>>B=A(2:4)
>>B=A(1:4)
>> A=rand(8,5)
>> help rand
>> A
>> A(2,4)
>> A(8,5)
>> A(1,:)
>> B=A(4,:)
>> A(:,1)
>> A(:,5)
>> C=A(2:4,:)
>> D=A(:,[1 3 5]);
>> max(A)
>>[T1 T2]=max(A)
>> mean(A)
>> max(mean(A))
>> max(max(A))
>> A=rand(2,2);
>> inv(A)
>> help inv
>>A^(-1)
5 Basic Math functions and plot
>> A=0:3
>> B=2.^A
>> log2(B)
>> x=0:0.1:10; y=sin(x);
>> plot(x)
>> plot(y)
>> figure
>> plot(x,y)
>> y2=cos(x);
>> y3=[y’ y2’]
>> plot(x, y3)
>> axis([0 20 -2 2])
>> help plot
>> help axis
Task 2. Follow the following procedures and execute the mfile (matlab script file). Give the detail explanation for each line.
1). Edit the following subscript file by using matlab editor and save it with your own filename “***.m”
clear
x=0:0.1:10;
for t=1:8
a=t/10;
if (a==0.6)
a=0.62;
end
y(t,:)=x.*sin(a*x);
end
plot(x,y)
xlabel('x')
ylabel('y=x sin (ax)')
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')
2).At the matlab command line, execute script file by typing as follows
>> bbiriri
.
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.
sine wave form generation
Ts=2;
step=0.001;
t=0:step:Ts;
Ns=10;
for n=1:16
sub_carrier(n,:)=exp(j*2*pi*n*t);
end
plot(t, real(sub_carrier))
Numerical integration : you can numerically calculate an integration of an arbitrary function over interval [a b]. This will be required for OFDM demodulation
%Example integration 1/(x^2+1) over [-2 4], You will get S equal to the integration result.
step=0.001;
a=-2;
b=4;
x=a:step:b;
ft=1./(x.^2 +1);
S= sum(ft)*step;
Vector(or matrix) concatenation) : will be required for Guard time insertion and OFDM symbol concatenation
a=[1 2 4];
b=[4 5 6];
c=[a b]
convolution : will be required for channel modeling
ht=[ 1 2 3 2 1];
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];
yt=conv(xt,ht)
plot(yt)
每个小题都有不同的要求,所以更加困难,而且是全英文。各位清帮帮忙。