logo(1)

矩阵实验室MATLAB代写|网课代修

MATLAB(Matrix Laboratory,矩阵实验室)是由美国The MathWorks公司出品的商业数学软件。MATLAB是一种用于算法开发、数据可视化数据分析以及数值计算的高级技术计算语言和交互式环境。除矩阵运算、绘制函数/数据图像等常用功能外,MATLAB还可用来创建用户界面,以及调用其它语言(包括CC++JavaPythonFORTRAN)编写的程序。

MATLAB主要用于数值运算,但利用为数众多的附加工具箱,它也适合不同领域的应用,例如控制系统设计与分析、影像处理、深度学习、信号处理与通讯、金融建模和分析等。另外还有配套软件包Simulink提供可视化开发环境,常用于系统模拟、动态/嵌入式系统开发等方面。

如果你也在 怎样矩阵实验室MATLAB这个学科遇到相关的难题,请随时右下角角联系我们的24/7代写客服

问题 1.

1.1.1 Example
a) Create a matrix of zeros with 2 rows and 4 columns.
b) Create the row vector of odd numbers through 21,
$$
\begin{array}{rlllllllllll}
\mathrm{L}= & & & & & & & & & & & \
1 & 3 & 5 & 7 & 9 & 11 & 13 & 15 & 17 & 19 & 21
\end{array}
$$
Use the colon operator.
c) Find the sum S of vector L’s elements.
d) Form the matrix
$$
\begin{aligned}
& \mathrm{A}= \
& \begin{array}{lll}
2 & 3 & 2 \
1 & 0 & 1
\end{array} \
&
\end{aligned}
$$

Solution:
a)
$$
\begin{aligned}
& \gg \mathrm{A}=\operatorname{zeros}(2,4) \
& \mathrm{A}= \
& \begin{array}{llll}
0 & 0 & 0 & 0 \
0 & 0 & 0 & 0
\end{array} \
&
\end{aligned}
$$
b)
$$
\begin{array}{lllllllllllll}
\gg & \mathrm{L}= & : & 2 & : & 21 \
\mathrm{~L}= & 1 & 3 & 5 & 7 & 9 & 11 & 13 & 15 & 17 & 19 & 21
\end{array}
$$
c)
$$
\begin{aligned}
& \gg \mathrm{S}=\operatorname{sum}(\mathrm{L}) \
& \mathrm{S}= \
& 121
\end{aligned}
$$
d)
$$
\begin{aligned}
& \gg A=[2,3,2 ; 1001] \
& \mathrm{A}= \
& \begin{array}{lll}
2 & 3 & 2 \
1 & 0 & 1
\end{array} \
&
\end{aligned}
$$

问题 2.

a) Create two different vectors of the same length and add them.
b) Now subtract them.
c) Perform element-by-element multiplication on them.
d) Perform element-by-element division on them.
e) Raise one of the vectors to the second power.
f) Create a $3 \times 3$ matrix and display the first row of and the second column on the screen.

a)
$$
\gg \mathrm{a}=\left[\begin{array}{ll}
2, & 1,3
\end{array}\right] ; \mathrm{b}=\left[\begin{array}{lll}
4 & 2 & 1
\end{array}\right] ; \mathrm{c}=\mathrm{a}+\mathrm{b}
$$
$$
c=
$$
$$
\begin{array}{llll}
6 & 3 & 4
\end{array}
$$
b)
$$
\begin{aligned}
& \gg c=a-b \
& \mathrm{c}= \
& \begin{array}{lll}
-2 & -1 & 2
\end{array} \
&
\end{aligned}
$$
c)
$$
\begin{aligned}
& \gg c=a, * b \
& \mathrm{c}= \
& \begin{array}{lll}
8 & 2 & 3
\end{array} \
&
\end{aligned}
$$
d)
$$
\begin{aligned}
& \gg c=a . / b \
& c= \
& 0.5000 \quad 0.5000 \quad 3.0000
\end{aligned}
$$
e)
$$
\gg c=a .-2
$$
$$
c=
$$
$$
\begin{array}{lll}
4 & 1 & 9
\end{array}
$$
f) $\gg d=\left[\begin{array}{lllllllll}1 & 2 & 3 ; & 2 & 3 & 4 ; & 4 & 5 & 6\end{array}\right]$; $d(1,:)$, $d(:, 2)$
$$
\text { ans }=
$$
$$
\begin{array}{lll}
1 & 2 & 3
\end{array}
$$

问题 3.

Let us plot projectile trajectories using equations for ideal projectile motion:
$$
\begin{aligned}
& y(t)=y_0-\frac{1}{2} g t^2+\left(v_0 \sin \left(\theta_0\right)\right) t, \
& x(t)=x_0+\left(v_0 \cos \left(\theta_0\right)\right) t,
\end{aligned}
$$
where $y(t)$ is the vertical distance and $x(t)$ is the horizontal distance traveled by the projectile in metres, $g$ is the acceleration due to Earth’s gravity $=9.8 \mathrm{~m} / \mathrm{s}^2$ and $t$ is time in seconds. Let us assume that the initial velocity of the projectile $v_0=50.75 \mathrm{~m} / \mathrm{s}$ and the projectile’s launching angle $\theta_0=\frac{5 \pi}{12}$ radians. The initial vertical and horizontal positions of the projectile are given by $y_0=0 \mathrm{~m}$ and $x_0=0 \mathrm{~m}$. Let us now plot $\mathrm{y}$ vs. $\mathrm{t}$ and $\mathrm{x}$ vs. $\mathrm{t}$ in two separate graphs with the vector: $t=0: 0.1: 10$ representing time in seconds. Give appropriate titles to the graphs and label the axes. Make sure the grid lines are visible.

We first plot $x$ and $y$ in separate figures:
$\gg \mathrm{t}=0: 0.1: 10$;
$\gg \mathrm{g}=9.8$
$\gg \mathrm{v} 0=50.75$;
$\gg$ thetao $=5 * \mathrm{pi} / 12$;
$\gg \mathrm{y} 0=0$
$\gg \mathrm{x} 0=0$
$\gg \mathrm{y}=\mathrm{y} 0-0.5 * \mathrm{~g} * \mathrm{t} \cdot{ }^{\wedge} 2+\mathrm{v} 0 * \sin ($ theta 0$) . * \mathrm{t}$;
$\gg \mathrm{x}=\mathrm{x} 0+\mathrm{v} 0 * \cos (\operatorname{theta} 0) . * \mathrm{t}$;
$\gg$
$\gg$ figure;
$\gg \operatorname{plot}(t, x)$;
$\gg$ title(‘ $x(t)$ vs. $\left.t^{\prime}\right)$;
$\gg x$ label (‘Time (s)’);
$\gg$ ylabel (‘Horizontal Distance (m)’);

grid on;
$\gg$
$\gg$ figure;
$\gg \operatorname{plot}(\mathrm{t}, \mathrm{y})$;
$\gg$ title(‘y(t) vs. $\left.t^{\prime}\right)$;
$\gg$ xlabel (‘Time (s)’);
$\gg$ ylabel (‘Altitude (m)’);
$\gg$ grid on;

Share the Post: