Question

In: Electrical Engineering

<<Importing Data>> Make sure you have downloaded all the data files off Blackboard. There should be...

<<Importing Data>>

Make sure you have downloaded all the data files off Blackboard. There should be folders containing images and audio files as well as a selection of CSV and Excel spreadsheets.

The following exercises will allow you to practice using MATLAB’s import/export functions.

Task 4 – Importing Excel Spreadsheets

Exercise:

Import the spreadsheet ‘buildings.xls’ which contains all the buildings in the world over 300 metres tall. Plot the number of floors vs. building height using a scatter plot.

Reflection:

- Look at how Excel data is imported into MATLAB. How is the text stored? How are the numbers stored?

- Repeat task 1 for these buildings and plot a graph showing the different velocities at impact the coin would have if dropped from these buildings instead.

Task 5 – Importing Comma Separated Values (CSV) files

Exercise:

In your MATLAB script file import the comma separated values in ‘scope1.csv’. This data has time data in column 1 and voltage data in column 2.

- Split the data into separate time and voltage arrays and plot voltage with respect to time.

Reflection:

- Contrast the CSV and Excel spreadsheet import processes and describe how the two differ.

Task 6 – Importing Audio files

Exercise:

In your script file, import the .wav file called ‘gameover.wav’: - Use the soundsc() function to listen to this audio.

Reflection:

- Try soundsc(x,30000) what happens to the playback of the audio?

- Try soundsc(x, 60000) what happens this time? Think about why this might be happening and the importance of correctly formatting data you are exporting from MATLAB.

- Try some of the other sound files in the audio folder.

- Refer to your tutorial notes from week 3 for more details.

Task 7 – Importing Images

Exercise:

Use the MATLAB script file to import the image ‘barbara.png’:

- Display this greyscale image using imshow().

- Now import and display the image ‘lena.tiff’, this image is a coloured image.

Reflection:

- Contrast the black-and-white image to the coloured image. Compare how they are stored as MATLAB matrices.

- Refer to your tutorial notes from week 3 for more details.

Solutions

Expert Solution

Image Read and Display:

-------------------------------

I = imread('barbara.png'); % reading image
imshow(I) % dislpay image
I_1 = imread('lena.tiff');
imshow(I_1)

--------------------------------------------------------

The black and white images are saved as binary(0,1) matrix while the coloured image are stored with some distinct values defining the colour of that pixel.

----------------------------------------------------------------------

Importing Audio file in matlab

---------------------------------

[x,Fs] = audioread('gameover.wav'); % reading file from current directory
soundsc(x,30000); %listening at 30Khz
pause;
soundsc(x,60000); %listening at 60Khz

-------------------------------------------------------------

Reading .csv file

=---------------------------------------------------------------

M = csvread('scope1.csv');
voltage = M(:,1);
time = M(:,2);
plot(time,voltage)

-----------------------------------------------------------

Importing excel file in matlab

---------------------------------------

num = xlsread('building.xls');
floors = num(:,1);
building_heights = num(:,2);
scatterplot(floors,building_heights)

=======================================


Related Solutions

Instructions:To make sure you have all the data you need to calculate the effect size, here...
Instructions:To make sure you have all the data you need to calculate the effect size, here are the means and standard deviations for the "hit" and "smashed into" groups from last week. Group Responses to Car Speed Hit v. Smashed Hit Group Smashed Into Group 32 50 26 44 40 54 23 45 42 44 20 40 37 49 25 34 24 38 22 30 19 50 24 46 19 40 22 35 29 43 24 41 34 30 33...
Code the following in C++ and make sure to include all three files required at the...
Code the following in C++ and make sure to include all three files required at the end. Hotdogs – The World’s Greatest Cost Effective Wholesome Nutritious Food Due to world food supply scarcity and the burgeoning populations of the world’s countries, your hot stand business is globalizing to satisfy the world’s desire for a cost effective wholesome nutritious food source. Market studies have shown that tens of billions of people are craving for the eponymous hotdog which will result in...
please answer all qustions and all parts and make sure you have the right answers. 1....
please answer all qustions and all parts and make sure you have the right answers. 1. An electric field is given by Ex = 3.5x3 kN/C. Find the potential difference between the points on the x axis at x = 1 m and x = 3 m. ..... kV --------------------------------- 2. (a) Find the maximum net charge that can be placed on a spherical conductor of radius 12 cm before dielectric breakdown of the air occurs. .... µC (b) What...
Make sure you name files with test_yourname in question 1, 4, and 5 Q1: Add a...
Make sure you name files with test_yourname in question 1, 4, and 5 Q1: Add a user named as test_yourname in linux terminal. Take a screenshot if it has been added to the system file /etc/passwd Q2: What is grep? And why is it used for? (2 lines only) Q3: Use grep over a file of your choice, take a screenshot and explain the results. Q4: Can you store the output of top command in a file named as: test_yourname.txt...
The answer should be thoughtful and have some critical thinking. Make sure there is no grammar...
The answer should be thoughtful and have some critical thinking. Make sure there is no grammar mistake and spelling error. No handwritten answer, type the answer, please. Thanks. Why do you want to work as an executive director at a senior/assisted living facility? Explain your answer.
How do you think that governments can make sure that all kids have real access to...
How do you think that governments can make sure that all kids have real access to magnet and charter schools instead of just those kids with advantages? How can government make sure that magnet and charter schools provide the quality education that taxpayers want for all children?
Make sure to include comments that explain all your steps (starts with #) Make sure to...
Make sure to include comments that explain all your steps (starts with #) Make sure to include comments that explain all your steps (starts with #) Write a program that prompts the user for a string (a sentence, a word list, single words etc.), counts the number of times each word appears and outputs the total word count and unique word count in a sorted order from high to low. The program should: Display a message stating its goal Prompt...
So This answer should be 280-330 words and make sure to have to separate paragraphs for...
So This answer should be 280-330 words and make sure to have to separate paragraphs for these two parts. Thank you Mentoring is defined as the opportunity for an individual to be led by a wiser and more experienced colleague, who can pass on knowledge, experience, and often make opportunities for advancement available that would have otherwise been unavailable to the protégé. Think of an instance when you had a mentor. Your example can be from work experience, a club,...
Find quantitative data about something that you are interested in. Make sure to get data on...
Find quantitative data about something that you are interested in. Make sure to get data on at least 50 individuals. 50 football players height a. You don’t need to collect the data yourself, but you do need to find out and explain how the data was collected. b. In order to be useful, this sample needs to be representative of some population.        i. What population is represented by your sample   ii. Describe biases that may result from your sampling method....
Make sure you understand the two alternatives. The "make" means that KCSB assembles and ships all...
Make sure you understand the two alternatives. The "make" means that KCSB assembles and ships all of its regular bicycles. The "buy" means that KCSB pays another firm to assemble and ship some of its regular bicycles and uses the freed-up resources to make and sell specialty racing bicycles. TIP: The analysis can be simplified by ignoring all irrelevant tiems - the revenue and the costs for the bicycles that are not being outsourced. Instead, just focus on 1) the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT