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...
Data Structures Use good style. Make sure that you properly separate code into .h/.cpp files. Make...
Data Structures Use good style. Make sure that you properly separate code into .h/.cpp files. Make sure that you add preprocessor guards to the .h files to allow multiple #includes. Overview You will be writing the classes Grade and GradeCollection. You will be writing testing code for the Grade and GradeCollection classes. Part 1 – Create a Grade Class Write a class named Grade to store grade information. Grade Class Specifications Include member variables for name (string), score (double). Write...
Question 4 [25 marks] [25 marks] Downloaded Bitmap files or images have lower resolutions when downloaded...
Question 4 [25 marks] [25 marks] Downloaded Bitmap files or images have lower resolutions when downloaded from the internet. Discuss into details how such files or images can be resolved and printed on a large format printer without losing its quality.
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,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT