matlab作业 | ios作业 | lab代写 – Model 1: Streamlines in Fluid Dynamics [50%]

Model 1: Streamlines in Fluid Dynamics [50%]

matlab作业 | ios作业 | lab代写 – 本题是一个利用matlab进行练习的代做, 对matlab的流程进行训练解析, 包括了matlab等方面, 该题目是值得借鉴的lab代写的题目

lab代写 代写lab

Differentials often occur in mathematical modelling of practical problems, for example in fluid dynamics such as

those observed in the flow around an airplane in flight. The image in Figure1 shows the streamlines around a

commercial airplane in flight. Streamlines are the paths along which the fluid flows there is no flow across a

streamline (the volume of fluid between two streamlines remains constant).

The definition of a streamline function. in incompressible flow where the velocity q at the point

(x,y) has components

is

These should be satisfied alongside the continuity equation.

where is the density of the fluid, is the 2D velocity vector. In the case of incompressible

2-dimensional flow, the continuity equation reduces to

Question 1 [20 marks]

We will begin the analysis by proving the reduced continuity equation for incompressible flow. By definition,

incompressible flow means that the total derivative of the density of the fluid with respect to time following the

fluid is equal to 0:

The rates of change with respect to time of the spatial dimensions x and y following the fluid are defined as

Show that by applying the definition of incompressibility to the continuity equation, it can be used to prove that

the divergence of the velocity in incompressible flow is equal to 0.

[Answer]

For incompressible flow
=

Question 2 [20 marks]

Consider the case of steady-state incompressible fluid flow in two dimensions, where it is known there are

distinct stream lines in the flow, observed experimentally through colouring with a die.

Find the stream function for the incompressible flow that is such that the velocity at the point (x,y) is

[Answer]

% Clear workspace
clc;
clear;
close all;
syms x y;
u = -y / (x ^ 2 + y ^ 2);
v = x / (x ^ 2 + y ^ 2);
-int(u,y)
ans =
int(v,x)
ans =

Question 3 [10 marks]

Plot the streamlines you found in Question 2 in MATLAB. What type of flow does that streamline function

correspond to? Discuss what technique taught in Vector Calculus in MMA 2 does the method applied in

Question 2 resemble.

[Answer]

X = linspace(-5,5,100);
Y = linspace(-5,5,100);
[x,y] = meshgrid(X,Y);
psi = 1 / 2 * log(x .^ 2 + y .^ 2);
figure();
set(gcf,'Position',[100,100,800,300]);
subplot(1,2,1); % Contour plot(psi = const)
contour(x,y,psi,10,'LineWidth',2);
grid minor;
xlabel('X');
ylabel('Y');
title('Stream Lines');
subplot(1,2,2); % Mesh plot
mesh(x,y,psi);
grid minor;
xlabel('X');
ylabel('Y');
title('Mesh plot for stream function')
Corresponding flow is incompressible flow, in other ways.

Model 2: Vision-based monitoring [50%]

Vision-based monitoring measures the displacements of civil infrastructure such as towers and bridges as

a way of performing remote observation and make decisions on maintenance actions. This relies on video

processing from a single-point displacement measurement, (i.e.the mid-span of a bridge).

However, to keep costs low, in practice such systems often have limited storage and processing capabilities

and require that the images taken are compressed. In this model, we will use Singular Value Decomposition

to create compressed images from on original, calculate resulting compression rat ios and discuss the loss of

accuracy.

Question 1 [10 marks]

Download the file Portico.csv from Moodle and import it into MATLAB. This comprises a 340*340 matrix

containing a greyscale image in Figure 2. To view the image, use the mat lab command imshow(P). A figure

window will appear with the image of the UCL Portico.

[Answer]

img_data = readmatrix("Portico.csv");
figure();
imshow(img_data);
[height,width] = size(img_data);

Question 2 [15 marks]

Perform a singular value decomposition of the image file into U , S and V in MATLAB using the svd function.

Discuss the type of matrices U , S and V are.

[Answer]

[U,S,V] = svd(img_data); % Perform Singular value decomposition(SVD)

Question 3 [15 marks]

Create an image from the first 10 principal components and view it in a new figure. This means

that you should only use the first 10 elements from each of the three matrices U , S and V to reconstruct the

image.

Then create images using the first 20 and 50 components and compare these three images to the original.

Calculate the compression ratio by comparing the number of elements present in the original 340*340 matrix

and the elements present in the U , S and V matrices used to reconstruct the 10, 20 and 50 component images.

[Answer]

k = [10,20,50];
k_num = length(k);
B = cell(1,k_num);
for i = 1:k_num
B{i} = U(:,1:k(i)) * S(1:k(i),1:k(i)) * (V(:,1:k(i)))'; % Reconstruct image
end
figure();
set(gcf,'Position',[100,100,1500,500])
subplot(1,k_num + 1,1);
imshow(img_data);
title('Original Image');
for i = 1:k_num
subplot(1,k_num + 1,i + 1);
imshow(B{i});
comp_ratio = round(k(i) / height * 100);
title({['k = ',num2str(k(i))];['(CompressRatio = ',num2str(comp_ratio),'%)']});
end

From the results, we can see that the larger the compression ratio(for bigger k), which means the larger

the compressed size, the closer the image is to the original image.

Question 4 [10 marks]

Now that we know how to create images with different compression ratios, we can examine the effect and

resulting loss of useful information. Below are four vision-based monitoring graphs of deflection from original

position in a bridge measured from images with different number of elements ( = 55,155,255,355).

Consider these images and the differences between the information they convey in terms of location and

magnitude of the maximum deflection detected. Discuss the trade off between image size and preservation of

useful information.

[Answer]