Numerical Methods II - Part 2
时隔一年,老师添加了一点新题,所以又来更新一下。
Numerical Integral, Matrices of Geometrical Transforms
近似计算定积分
Write an M-file for using quadrature formulas.
The name of the function be: numint
Input arguments: integrand (as a string),
the endpoints of the interval (a, b),
number of divisors (n),
type of the quadrature (rectangle, trapezoid, simpson)Output argument: the result of the integral.
1 | % 7.1 近似计算定积分 |
原点 affine 变换
Write an M-file, what gives the matrix of any affin transform with fixed point in Origin
The name of the file: affin1
- Input arguments: The images of points (0, 1) and (1, 0).
- Output argument: The matrix of the transform.
- If someone calls the function without input arguments give them an opportunity for the graphical input.
1 | % 7.2 计算具有原点固定点的 affine 变换矩阵 |
1 | % 输入示例 |
三角变换
Write an M-file, what gives the matrix of any affin transform.
The name of the m-file: affin2
- Input arguments: a triangle (with the coordinates of the edges) and the image of the triangle (also with the edges)
- Output argument: The matrix of the transform.
- Give an opportunity for graphical input (as in the previous exercise)
- Draw a figure in both cases.
1 | % 7.3 计算基于一个三角形及其映射后的三角形的仿射变换矩阵 |
1 | % 输入示例 |
等边三角形
Give 3 points in the plane. Two of them, P (2; 3) and Q (4; 2), lie on different sides of an equilateral triangle.
The third point, S (3; 3), is the centroid of the triangle.
Use MATLAB to find the vertices of a triangle (by adding the coordinates of the vertices) and make an illustration for the exercise.
1 | % 定义点 P, Q 和 S |
Numerical Methods II - Part 2