联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp

您当前位置:首页 >> Matlab编程Matlab编程

日期:2019-03-05 09:02

ENG 06 Winter 2019 Final Project

Up to now in ENG6, we have focused on teaching you the “how” of programming. In the team

project you will be taking your own ideas and bringing them to fruition through your knowledge of

computer programming. Software development is rarely a one-person effort, so the project will

be team-based. Teams can be formed with members of any section. You can form your own team

of three. No other team size will be allowed. Only if strictly needed, the TAs may form smaller

teams or add members to teams. Beyond the core part of the final project, we ask you to

implement a number of special features, called Reach elements, so as to make your project

different from your classmates.

One of the main features of the Final Project is the Graphical User Interface (GUI). In the past

this was implemented using Guide, however, the new Apps capabilities male this task a lot easier

and you have a lot of tools at your disposal that help you implement the GUI. Therefore, we are

limiting the implementation of GUI’s using the Apps approach.

You will be able to choose between three different implementations.

Project 1: Electronic Data Acquisition and Processing using Matlab.

In this project you will be using an Arduino Uno microprocessor to acquire analog signals from a

sensor. You may choose any other microprocessor but Matlab commands to control the

microprocessor must be available on Matlab.. You have the freedom to choose the variable to

be measured, however, a few possibilities are:

Temperature using a thermistor

Light using a photocell or phototransistor

Acceleration using a gyroscope

Magnetic field using a Magnetometer

Humidity using a hydrometer

A sensor measuring more than one of the above variables!

Please keep in mind that since this is not a hardware electronics class, your grade will be based

mostly on the originality of the Graphical User Interface (GUI) implementation, data processing

and presentation. It will be your responsibility to acquire the microprocessor and associated

electronics (sensors, resistors, etc.). However, today an Arduino (for example) can be acquired

for less than $17 and the cost of the sensing electronics is a few dollars as well but you are not

confined to use an Arduino. What is important in this project is how you process and display

the data using Matlab.

Core Requirements: All projects should have a graphical user interface with the following

capabilities:

1. A frame with a graph displaying the sensed signal in quasi real time. If you wish you can

display more than one signal at a time.

2. A button to record a signal over a predetermined time interval.

3. A button to display the recorded signal either on a separate frame or on the one used for real

time display.

4. An indicator on the control panel, coupled to an LED in the data acquisition board, that are

ON while the data is being sampled.

Special Features: You can choose the special features you decide to implement, however, a few

examples are:

Signal noise removal based on taking the average of a predetermined number of data sets

followed by the display of the raw and averaged data on the GUI panel.

Finding and displaying signal statistics such as mean, standard deviation, peak amplitude

of a signal, etc.

Horizontal and/or vertical cursors controlled by sliders that indicate the x or y coordinate

of the cursor. Even better, more than one cursors to show the x or y-coordinate difference

between the two. This can be used, for example, to indicate the width of a pulse signal

(FWHM) or a 10-90 raise/ fall times.

Signal reversal, slow or fast motion, signal arithmetic (addition, subtraction) between

multiple signals.

Your own ideas….!

Appendix: Useful information in case you have selected an Arduino.

In order to be able to send and receive analog and digital data to the Arduino it is necessary to

install the MATLAB support package for Arduino.

Instructions for the installation can be found on:

https://www.mathworks.com/help/supportpkg/arduinoio/ug/intro.htm

You can check if the support package was installed correctly if you enter:

>>help writeDigitalPin

--- help for arduino/writeDigitalPin ---

Write digital pin value to Arduino hardware.

Syntax:

writeDigitalPin(a,pin,value)

Description:

Writes specified value to the specified pin on the Arduino hardware.

Example:

a = arduino();

writeDigitalPin(a,'D13',1);

Input Arguments:

a - Arduino hardware

pin - Digital pin number on the Arduino hardware (character vector or string)

value - Digital value (0, 1) or (true, false) to write to the specified pin (double).

See also readDigitalPin, writePWMVoltage, writePWMDutyCycle

A few examples on basic connections to the Arduino can be found on:

https://www.mathworks.com/help/supportpkg/arduinoio/ug/getting-started-with-matlab-supportpackage-for-arduino-hardware.html

Instructions to find the Arduino port can be found on:

https://www.mathworks.com/help/supportpkg/arduinoio/ug/find-arduino-port-on-windows-macand-linux.html

The following link provides a straightforward way on how to improve the accuracy of Arduino

signals measured as a function of time.

https://www.mathworks.com/videos/log-temperature-data-from-arduino-into-matlab-

1489428648919.html

Project 2: Steganography

Steganography is the practice of concealing a message, image, or file within another

message, image, or file. The advantage of steganography over cryptography alone is that

the intended secret message does not attract attention to itself. The general idea is to store

the hidden image in the red, green, and blue channels of the RGB image without changing

the pixel color by a perceivable amount. For more information check here:

http://en.wikipedia.org/wiki/Steganography. In this project you will be embedding at least 10

secret images simultaneously into an inconspicuous image (The dog image). All the

images are in the file steganography.zip

Before starting on the project make sure to read the entire document as Parts 1-4 makes

references to a GUI that is detailed in Part 5. It is up to you if you create the GUI first or

last.

Part 1: Flattening the Images

1. There is an image dog.png, which you will be concealing at least 10 hidden images in.

Try viewing it with <image>.

2. There are ten images labeled hiddenXX.png with XX from 1 to 10. Let’s take the

grayscale hidden image and make it black and white:

a. Load one of the hidden images. It should be in a 400x400 integers matrix

(grayscale).

b. Create a function to “Flatten” the image by creating a 400x400 matrix with values

“1” if the corresponding hidden image pixel is dark and “0” if the pixel is light

(black&white). Your threshold for dark/light is up to you as long as the image is

still distinguishable after converting from grayscale to black&white.

c. Create a function to “Expand” the flattened image by taking the 400x400

flattened image and creating a new RGB image with black pixels for “1”

elements, and white pixels for “0” elements.

d. Test by Flattening and Expanding one of the images and making sure it can be

displayed properly with the <image> command.

Part 2: Create Embedding Techniques

As an example for one of the techniques that can be used is the odd/even embedding

technique

This is an example one of the different techniques that you will use to hide all the black and

white images into the concealing image.

The flattened hidden image is a 400x400x1 matrix of values 0 (white) and 1 (black) pixels. The

normal image is a 400x400x3 matrix of values 0-255, representing the values of the red, green,

and blue channels. Our first embedding technique goes as follows:

1. Use your “Flattening” function from part 1 to flatten the hidden image selected by the

user to a flattened hidden image.

2. If flattened hidden image pixel (x,y) is black, make the red channel of pixel (x,y) in the

normal image odd valued by either subtracting zero or one.

3. If flattened hidden image pixel (x,y) is white, make pixel (x,y) on the red channel of the

normal image even valued by either subtracting zero or one.

In your GUI call this method the “Odd/Even Red Embedding”.

Part 3: Create Recovery Technique

Note that for every embedding technique created in part 2, an appropriate recovery technique

has to be created. As an example, we show you the recovery technique for the odd/even

embedding technique. To recover the hidden image back from our embedded image we can

perform the following:

1. Create a blank matrix of size 400x400. Let’s call it our recovered image.

2. If the embedded image red channel pixel (x,y) is odd valued, set recovered image pixel

(x,y) to 1. Otherwise set it to 0.

3. Use your “Expand” function from part 1 to convert the 400x400x1 recovered image into

a RGB so it can be displayed in your GUI.

In your GUI call this recovery method “Odd/Even Red Recovery”.

Part 4: More Embedding Techniques

Here is where your creativity comes in. We have gone through one method of embedding a

hidden black and white image within a RGB image. You have a total of 10 images you need to

embed anyway you would like. Here are some suggestions:

Remember you have a red/green/blue channel so you can embed and image per

channel per embedding technique (i.e the odd/even technique can save 3 images in the

red, green, blue channel respectively).

You will find the MOD function important. Think about how you can use the modulus of

the pixel values in a similar fashion to how we used the odd/even-ness of the values.

The idea is that whatever operation you apply to the pixels of the normal image, there is

a way of identifying what was done. In the case of the odd/even method we can identify

if a pixel is odd or even. We could have also done things like set the last digit of every

pixel to be 3.

Remember your methods need to work together nicely. If you apply method X then

method Y, method Y should not interfere with the recovery using method X!

Part 5: Create a User Interface

Create a GUI which meets the following criteria:

1. Allows the user to load a normal image (you are given an image of a dog but any

400x400 pixel png image should work). When the user chooses this option, the image

should appear.

2. Allow the user to pick one or more of the ten hidden images to embed in the normal

image.

3. Create buttons/list to allow the user to select which of the hiding techniques to apply to

the images needed to be hidden.

4. Create a button to save the resultant image after embedding the hidden message(s).

5. The GUI should allow loading an embedded image and extraction of hidden images

using each of the methods.

6. The more extra features your group adds to the GUI, the more points you will get for

creativity. Below is an example of a GUI layout you could make for the project:

Project 3: Arbitrary Function Generator.

In this project you will be implementing a digital arbitrary function generator. A function generator

is a device that is able to generate periodic, or repetitive, waveforms with shapes commonly used

in a wide range of fields spanning most engineering disciplines as well as basic science. In

addition to be able to create simple sinusoidal waves, the function generator is able to create

repetitive waveforms with a number of commonly used shapes and one your goals will be to

generate a specified number of waveforms. In most cases, a function generator is able to vary

the characteristics of the waveforms such as changing the frequency and its amplitude. Another

capability is that the function generator may be able to add a DC offset to the signal.

In 1807 Jean Baptiste Joseph Four postulated that a periodic waveform could be broken into and

infinite series of simple sinusoids that, when added together, would reproduce the exact replica

of the original waveforms. The expression for the infinite sum of related sinusoids is known as a

Fourier series and is given by:

T is the period of the waveform and ao, an and bn are known as the Fourier

coefficients. This equation simply indicates that any periodic signal can be obtained by adding

multiple sinusoidal signals of different frequency and amplitude. The different sinusoids will add

and subtract to create the desired function. Keep in mind that more sinusoidal terms we add the

better representation of the signal. The term ao, which is not always present, represents the DC

shift, i.e. depending on its sign it will shift the signal up or down in the y-axis.

Following are the Fourier series for the most common waveforms that function generators are

capable to generate. Fortunately, we can apply function symmetry properties, e.g. even or odd

symmetry, etc., that for the most common waveforms result in summation of only cosines or sines

with even or odd n-values.

Sine wave: A function generator will normally have the capability to generate a sine wave. This

waveform oscillates between two amplitude levels with the additional capability of introducing a

positive or negative DC-shift. For this waveform the waveform is simply given by:

Rectangular wave: A rectangular wave consists of a signal moving directly between high and

low constant levels. The Fourier series for this waveform is given by:

Notice that in this case the frequency ωo will be multiplied by 1, 3, 5...etc, i.e. odd numbers. For

example, for n = 1 we have 3ωo which is known as the third harmonic of ωo. Also notice that the

amplitude of the harmonics will be decreasing by 1/3, 1/5, etc. It should be clear now that the

rectangular wave is an addition, or superposition, of odd harmonics with decreasing amplitudes.

Triangular wave: A triangular waveform linearly moves between a high and low point. The

Fourier series for this waveform is given by:

Sawtooth wave: This is a waveform is very similar to the triangular but with the rise edge faster

or slower than the fall, making a form of shape similar to a sawtooth. The Fourier series for this

waveform is given by:

Full wave rectified: This is a waveform that results after a sinusoidal waveform has been to an

arrangement of rectifiers (or diodes) know as a full-wave rectifier. This waveform is then routed

through a capacitor and a resistor connected in series (a low pass filter) to generate a cuasi-

constant waveform, i.e. it converts an alternating waveform into a constant waveform. The Fourier

series for this waveform is given by:

Core Requirements: All projects should have a graphical user interface that display the

waveforms with the following Function generator controls:

1. Frequency: As would be expected, this control alters the basic frequency at which the

waveform repeats. It is independent of the waveform type. You are free to select the frequency

range but we recommend you limit to the range that can be perceived by young humans, i.e.

20 Hz to 20 KHz.

2. Waveform type : This control enables the generation of different basic waveform types to be

selected. Your function generator should be able to produce the following waveforms.

a. Sine wave

b. Square wave

c. Triangular wave

d. Sawtooth

e. Full-wave rectified

3. DC offset: This control alters the average voltage of a signal relative to 0V or ground. It shifts

the waveform either up, or down.

4. Amplitude control. This control alters the peal waveform value.

Special Features:

Pulse wave generator: In addition to the waveforms describe above add an option to generate

a pulse waveform which is another very useful type commonly produced by a function generator.

It is very similar to a square wave, but with the high voltage to zero voltage ratio different to 1:1.

The Fourier series for this waveform is given by:

????=1 .

where Tp is the width of the high voltage portion of the waveform and T is the waveform period.

Pulse waveform duty-cycle control: This control on the function generator changes the ratio of high

voltage to zero voltage time in the pulse wave signal, i.e. changing the waveform from a square wave

with a 1:1 duty cycle to a pulse waveform.

Sound playback: Implement a capability to generate sound in synchronicity to the displayed

waveforms.

Any other capability: Implement any features you may think are cool and/or useful.

Project Deadlines:

Deadline #1: Friday, February 22, 5:00 pm: A team member must submit your team names to a

Google Docs Form. We will post a Canvas announcement once the form is ready for submissions.

Only one team member should do this!

Deadline #2: Tuesday, February 26, 5:00 pm: Submit proposal.

Deadline #3: Thursday, March 14, 5:00 pm: Each team will submit all relevant coding files, a link

to Youtube video and team evaluation materials. Each team will submit a zip file of all the code,

the zip file will have all .m files, all .img files and any other files that are needed for the game to

run. The zip file should also contain a .pdf file of the code, as well as a PDF of the team evaluation

document. The link of the Youtube should be accessible to all those who use the link.

Collaboration Policy: Once teams are formed you are only allowed to talk and collaborate with

members within your team. Team members are expected to equally participate, and

collaboratively work towards the completion of the project. Other than contacting the teaching

assistants for clarification, you may not seek the assistance of other persons to complete your

team's project. (Of course, general discussions about how to implement GUI, OOP and other

programming constructs could be discussed with other students, but your team must be totally

responsible for the implementation of code used in your project).

Grading Criteria: The projects are open ended. As long as your program can perform the

assigned tasks, there will be no correct or incorrect approaches. Certainly there will be more

acceptable and attractive solutions, and that will be judged in comparison with competing

solutions submitted by your classmates. The final project will be graded in five parts:

1. Project proposal: Each team submits a 2-3 page via Canvas a project proposal describing

the project they have selected, a general description of how you will implement the main

components of your project and a clear description of the Reach features that your team

proposes. Essentially, the scope of the project should be challenging enough to merit full

credit and doable within the timeline. An Appendix should contain a breakdown of

programming tasks, and who will be responsible for what, along with a timeline that will meet

the submission deadline (suggest you make use of a Gannt chart (Links to an external site.)

.. The expectation is that each team member must take responsibility for a specific aspect of

the project and grading for each member will be adjusted according to how the project tasks

were delegated and who was responsible for what aspects of the project. The more specific

you can be in defining the programming tasks, what functions should exist, and what each

function should accomplish, the better. For the data acquisition project using Arduino it is not

allowed to have a team member working solely on the electronic implementation, i.e. all team

members must have MATLAB coding responsibilities.

2. Core: Complete the basic project as outlined in the project specification.

3. Special Features: A significant component of the project grade will depend on the special

features your group decides to implement. The main goal of this portion of the project is for

you to show your data processing skills. Implement the project extensions described in your

proposal. Your completion of the Core and the difficulty of your proposal will be taken into

account during the grading process.

4. Youtube Video Requirements: Youtube has several examples of ENG6 videos (search

ENG6). The format of the video is entirely up to your team as long as the following criteria are

met:

a. Maximum length of the video is 10 minutes

b. Each team member must be seen in the video to present their work and contributions

c. A clear and easy to follow demonstration that shows the correct functionality of your

program (show your program actually working in the video – not screen shots of before

and after.)

d. In your YouTube video, please point out how you implemented some features

(especially in the Core and the Special Features) inside your code. What functions

did you use? Did you use any data structures such as structs etc.? What was

challenging about implementing a certain feature and why?

e. Use visual aides to help explain your steps (whiteboard, markers, poster, etc.). The

video does not have to be fancy, just effective in relaying the most important

information.

5. Team Evaluations: Each member must provide a brief personal summary of her/his

involvement and contributions. Each team member is required to submit evaluations of your

and your teammates’ contribution, one for each of Core and Reach. For example, if your team

has members A, B, C, your evaluation can be similar to the following for a single member. An

example is shown below.

Team Member A: was in charge of writing the code to execute the equalizer filters. For the Reach,

A was in charge of adding 2 different analysis plots that could show power spectral density plot

and frequency content of audio file. Team Members B, C agree that A performed these tasks for

the project.


版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp