Using the wind energy data set below, write a matlab script that include the fol
ID: 3706492 • Letter: U
Question
Using the wind energy data set below, write a matlab script that include the following http://data. un .org/Data.aspx?d-EDATA&?cmID%3aEW The script file(s) must cover 6 out of the 8 Lecture topics from class (see topics below). Each include: 1) Input statements 2) Output statements 3) Reading data from Excel into Matlab (xlsread) 4) Graphing in MATLAB (use both the plot, imshow, or bar commands) Comit m.escod Try to have at least two figures generated from graphing 5) Conditional Statements (if-elseif-else-end / switch-case) 6) Loops (For /While) 7) Array Operations (Array Math and Array conditional statements) 8) Array Applications (Handling Data Files, this is easy since it is the project topic) In your code, you must identify with comment lines where you actually apply the above topicsExplanation / Answer
%% input statement
prompt = 'Input: ';
x = input(prompt); %input
%% output statement
disp(x); %output
%% read data from excel to matlab
filename = 'myExample.xlsx';
A = xlsread(filename); %fileread
%% graphing in matlab
x = 0:pi/100:2*pi; % x from 0 to 2*pi with increment of pi/100
y = sin(x);
plot(x,y) %plot
I = imread('file.jpeg');
imshow(I); %imshow
x = 1900:10:2000; % x from 1900 to 2000 and icrement is 10
y = [75 91 105 123.5 131 150 179 203 226 249 281.5];
bar(x,y) %bar
%% conditional if-elseif-else
a=60;
if a < 30
disp('small');
elseif a < 80
disp('medium');
else
disp('large');
end
%% switch case
n = input('Enter a number: ');
switch n
case -1
disp('negative one')
case 0
disp('zero')
case 1
disp('positive one')
otherwise
disp('other value')
end
%% loops
x = ones(1,10);
for n = 2:6 % n is from 2 to 6 with 1 incremental
x(n) = 2 * x(n - 1);
end
%% array operation
A = [1 1 1]
B = [1 2 3]
C = A + B; % normal addition of two array
disp(C);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.