matlab 要求所建子向量元素为奇数
来源:百度知道 编辑:UC知道 时间:2024/09/28 09:23:33
1. Dene the quantities alpha and beta in MATLAB
alpha = (0; 11; 3; 5; 5;6; 7;8; 9; 10)
beta = (2; 5; 3; 7; 8; 2; 4; 1; 7; 5)
What is the result of beta(5)? alpha(8)?
Extract the sub-vector e of the vector alpha made of elements whose indices are even.
Extract the sub-vector o of the vector alpha made of elements whose indices are odd.
Form a vector r made of the elements of the vector beta in reverse order.
alpha = (0; 11; 3; 5; 5;6; 7;8; 9; 10)
beta = (2; 5; 3; 7; 8; 2; 4; 1; 7; 5)
What is the result of beta(5)? alpha(8)?
Extract the sub-vector e of the vector alpha made of elements whose indices are even.
Extract the sub-vector o of the vector alpha made of elements whose indices are odd.
Form a vector r made of the elements of the vector beta in reverse order.
1) What is the result of beta(5)? alpha(8)?
beta(5)=8, alpha(8)=8;
2) Extract the sub-vector e of the vector alpha made of elements whose indices are even.
e=alpha(2:2:length(alpha));
3) Extract the sub-vector o of the vector alpha made of elements whose indices are odd.
o=alpha(1:2:length(alpha));
4) Form a vector r made of the elements of the vector beta in reverse order.
r=beta(length(beta):-1:1);