《信号与系统》实验指导书

2.5 执行完2.4的所有题目后,w(2,1)的值是多少? x(2,1)的值是多少?y(2,1)的值是多少?

2.6 c 数组的定义如下,写出下面子数组的内容。

c =

1.1000 -3.2000 3.4000 0.6000 0.6000 1.1000 -0.6000 3.1000 1.3000 0.6000 5.5000 0

(1) c(2,:) (2) c(:,end) (3) c(1:2,2:end) (4) c(6) (5) c(4:end) (6) c(1:2,2:4) (7) c([1 4],2) (8) c([2 2],[3 3]) 2.7 当赋值语句执行后,下列数组的内容是多少?

(1) a=[1 2 3; 4 5 6; 7 8 9]; a([3 1],:)=a([1 3],:); (2) a=[1 2 3; 4 5 6; 7 8 9]; a([1 3],:)=a([2 2],:); (3) a=[1 2 3; 4 5 6; 7 8 9]; a=a([2 2],:);

2.8 假设a,b,c 和d 的定义如下:

?1 a???20?,b?1????1?0?2??3?,c??,?d? 51???2?分别运行出下列表达式的运算结果,并思考点乘和乘法的不同。

(1) a + b (2) a .* c (3) a * b (4) a * c (5) a + c (6) a + d (7) a .* d (8) a * d 2.9一个程序实例学习:

(温度转换)设计一个MATLAB 程序,读取一个华氏温度的输入,输出开尔文温度。 华氏温度和开尔文温度的转换关系式可在物理学课本中找到。其关系式为:

在物理学参考书中举了一些例子,我们可以用来检验我们程序是否正确。例如

2

我们设计程序的步骤如下 : (1)提示用户键入华氏温度值 (2)读取输入值

(3)通过关系式转换为开氏温度 (4)输出结果,结束

我们将会用input 函数输入华氏温度,用fprintf 函数输出结果。 % Script file:temp_conversion.m %

% Purpose:

% To convert an input temperature from degrees Fahrenheit to % an output temperature in kelvins. %

% Record of revisions:

% Date Programmer Description of change % ==== ========= ================ % 12/01/97 S.J.Chapman Original code %

Tfine variables:

% temp_f --Temperature in degrees Fahrenheit % temp_k --Temperature in kelvins

%Prompt the user for the input temperature.

temp_f=input('Enter the temperature in degrees Fahrenheit:'); %Converttokelvins.

temp_k=(5/9)*(temp_f-32)+273.15; %Writeouttheresult.

fprintf('%6.2f degrees Fahrenheit = %6.2f kelvins.\\n',... temp_f,temp_k);

我们输入上面的例子中的华氏温度值,以检测程序的正确性。注意用户的输入值已用黑 体字标出

>>灞曞紑鍏ㄦ枃<<
12@gma联系客服:779662525#qq.com(#替换为@)