Question

Please solve this using matlab code

to solve part 1 this is the timevector to use

timevector=.25:.25:24;

Thǐ block of code ini tidl İze3 r1a t a you need to solve the problerns in clear all, cIC Do not remove solardayl- [0 0 000 000 0 0000 00000 00000000000 0.04 0.08 0.092 0.12 0.124 0.14 0.152 0.168 0.452 1.244 2.196 2.676 2.824 2.964 3.108 3.208 3.296 3.4 3.456 3.54 2.828 3.72 3,716 3,728 3.684 3.628 3.392 3.444 1.916 2.628 2.944 1.088 1.952 1.628 2.288 2.912 1.532 1.088 1.9 1.912 1.76 1.452 1.184 0.936 0.584 0.304 0.196 0.092 0.04 0 00 0 0000 000 000000 01 solarday2 [0 0000000 00000000000 0000 000 000 0.008 0.064 0.132 0.236 0.304 0.336 0.372 0.436 0.52 0.628 0.8 0.8 0.76 0.768 0.792 0.784 0.84 0.852 0.860.956 0.952 0.952 0.888 0.736 0.772 0.82 0.772 0.82 0.776 0.668 0.6 0.632 0.552 0.472 0.404 0.368 0.388 0.376 0.396 0.288 0.196 0.116 0.052 0.044 0.048 0.028 0 0 0 00 0 0 0 0 0 0 0 0 0 0 0 00 0 0 0j solarmonthi -24.84 26.312 25.906 23.933 5.806 26.112 14.859 14.395 25.596 25.095 24.192 19.564 15.804 23.682 20.763 12.482 15.157 22.369 9.581 20.B55 23.066 17.441 14.682 22.507 24.048 23.271 22.34 25.463 21.017 16.2621; timeinterval0.25 units of hrs, 0.25 hour15 minute: ASSIGNMENT DESCRIPTION (contrived scenario using real data) Baseline solar has hired you as an intern tor their company because they % hoard you could holp thom implomont some data diagnostic tools which % could provide potential customers with valuable information about the % benefits of solar power and how power generation fluctuates over time On the first day, they provides you with several files from one of their t units and a5к you to ao some mone ing and analysis that wil help them as they converse with potential customers. % The variables solarday! and solarday2 each represent a % different day of olar power generation at an ctual home in The valueะ represent power values {in kli) t-ken at 15 minute intervals in 굔 a 24 hour day. The variable solamonthl 13 a vector containing total 3 energy generated over the course ot a given day (-hr), tor eac O 30 given days in a month % Your supervisor asks you to do the following: Part 1 % which corresponds to both solardayi, solarday? , and your % timev.ctor. If the value in the solardata is non-zero, this means the % solar panel is actively generating power at this specific time and the % corresponding value in the new activewindow vector would be 1. The Create an activewindow vector of zeros and ones vector should be created 2 different ways. One i more time-intensive but demonstrate knowledge of conditiondl structur습s (an İf-else-end) all within a looping structure (for ENGE 1215, a while loop). The second method is much more elegant and leverages MATLAB3 % built in tunctionality or element-wise vector math. 2oth methods should % givo the samo rosult % start solution

0 0
Add a comment Improve this question Transcribed image text
Answer #1

%Create the vectors solarday1, solarday2
solarday1 = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0.08 0.092 0.12 0.124 0.14 0.152 0.168 0.452 1.244 2.196 2.676 2.624 2.964 3.108 3.208 3.296 3.4 3.456 3.54 2.828 3.72 3.716 3.728 3.684 3.628 3.392 3.444 1.916 2.628 2.944 1.088 1.952 1.628 2.288 2.912 1.532 1.088 1.9 1.912 1.76 1.452 1.184 0.936 0.584 0.304 0.196 0.092 0.04 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
solarday2 = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.008 0.064 0.132 0.236 0.304 0.336 0.372 0.436 0.52 0.628 0.8 0.8 0.76 0.768 0.792 0.784 0.84 0.852 0.86 0.956 0.952 0.952 0.888 0.736 0.772 0.82 0.772 0.82 0.776 0.668 0.6 0.632 0.552 0.472 0.404 0.368 0.388 0.376 0.396 0.288 0.196 0.116 0.052 0.044 0.048 0.028 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];

%% Part 1
%create activewindow vector using looping structure
%Define the array activewindowloop1, activewindowloop2
activewindowloop1 = zeros(length(solarday1));
activewindowloop2 = zeros(length(solarday2));

for i = 1:length(solarday1)
if solarday1(i) ~= 0
activewindowloop1(i) = 1;
end
end

for i = 1:length(solarday2)
if solarday2(i) ~= 0
activewindowloop2(i) = 1;
end
end

%Print the results
disp('Active Window using looping structure');
disp('Active Window 1 =');
disp(activewindowloop1);
disp('Active Window 2 =');
disp(activewindowloop2);

%Create active window vetor using Matlab's element-wise vector math
%Define the vectors
activewindowele1 = solarday1 ~= 0;
activewindowele2 = solarday2 ~= 0;

%Print the results
disp('Active Window using Matlab Built in element-wise vector math');
disp('Active Window 1 =');
disp(activewindowele1);
disp('Active Window 2 =');
disp(activewindowele2);

Screenshot of Output:

MATLAB R2017a PLOTS EDITOR lSearch Documentation Log In Find Files 凶Compare ▼ 연 Run Section Go To▼ Comment 1 96.aste New Open Save BreakpointsRun Run and Advance Run and Print ▼ Find Indent Advance FILE C. Program Filesト MATLAB R2017aトbin Command Window >solar Active window using looping structure Active Window 1- Columns i through 21 Colunns 22 througn 42 Colunns 43 througn 63 Colunns 64 througn 84 Colunns 85 througn 96 Active Window 2 Columns 1 through 21 04:19 OType here to search ^恤脈 ENG 10-01-2019 TOMATLAB R2017a PLOTS EDITOR lSearch Documentation Log In Find Files 凶Compare ▼ 연 Go To▼ Comment 1 96.aste New Open Save BreakpointsRun Run and Advance Run and Print ψ Find Indent Advance FILE C. Program Filesト MATLAB R2017aトbin Command Window Columns 22 through 42 Columns 43 through 63 Columns 64 through 84 Columns 85 through 96 Active Window uing Matlab Built in element-wise vector math Active Window Columns 1 through 32 Columns 33 through 64 Columns 65 through 96 04:20 OType here to search ^恤脈 ENG 10-01-2019 TO

Add a comment
Know the answer?
Add Answer to:
Please solve this using matlab code to solve part 1 this is the timevector to use...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Q: please solve using matlab code withe comment 1.      Write the Matlab code to generate: x...

    Q: please solve using matlab code withe comment 1.      Write the Matlab code to generate: x = cos(w1*t) + cos(w2*t); where, w1=7; w2=23; t = [0:0.005:2] 2.   Plot the signal using sub plot a.   in time domain b.   in frequency domain 3)   Sample the signal under different sampling conditions: a.      Ts<1/2fm b.      Ts=1/2fm c.       Ts>1/2fm 4).      Multiple plot: the signal sampled under sampling condition and the signal x a.      in time domain b.      in frequency domain c.       Label and Title...

  • Use the attached Matlab code as a basis to solve the following ordinary differential equation usi...

    Question 1 QUESTION 2 Use the attached Matlab code as a basis to solve the following ordinary differential equation using Euler's method, with timestep of 0.1, from t-0to t-100. d)0) -0 - sin (5vt cos(у Plot y versus t from t=0 to t=100. How many local maxima are on this interval(do not include end points). Be careful to count them all! Answer should be an integer 1 w% Matlab code for the solution of Module 2 3 dt-9.1; %dt is...

  • Solve using MATLAB code 22.2 Solve the following problem over the interval from 0 to 1...

    Solve using MATLAB code 22.2 Solve the following problem over the interval from 0 to 1 using a step size of 0.25 where y(0) 1. Display all your results on the same graph. dy dx (a) Analytically (b) Using Euler's method. (c) Using Heun's method without iteration. (d) Using Ralston's method. (e) Using the fourth-order RK method. Note that using the midpoint method instead of Ralston's method in d). You can use my codes as reference.

  • using matlab to solve this problem as soon as possible thanks use matlab to slove the...

    using matlab to solve this problem as soon as possible thanks use matlab to slove the problem as soon as possible solve the activity of number 1&2&3 by using matlab for this problem i need from you to solve activity one and two and three by using matlab DIRECTIONS: Perform the following using MATLAB. After the simulation, your report must be uploaded in the Moodle Learning system. ACTIVITY I. VECTORS AND ITS OPERATIONS Procedure 1: Define two vectors a and...

  • please write a MATLAB code to solve this problem, all parts from a to d have...

    please write a MATLAB code to solve this problem, all parts from a to d have to be solved in matlab. Thank you        u The 26-in. drum rotates about a horizontal -7.5 rad/sec axis with a constant angular velocity Q 7.5 rad/s. The small block A has no motion relative to the drum surface as it passes the bottom position 0 0. r-13 a) Determine the coefficient of static friction that would result in block slippage at an angular position...

  • please use matlab only COMPUTER PROBLEMS 8.6 1. Write a computer program to solve this initial-value problem using the Taylor-series method. Include terms in h, h2, and h and continue the solution...

    please use matlab only COMPUTER PROBLEMS 8.6 1. Write a computer program to solve this initial-value problem using the Taylor-series method. Include terms in h, h2, and h and continue the solution tor 1. Let h 0.01 x1 = t + x1+x2 i xd-1)=0.43 avl COMPUTER PROBLEMS 8.6 1. Write a computer program to solve this initial-value problem using the Taylor-series method. Include terms in h, h2, and h and continue the solution tor 1. Let h 0.01 x1 =...

  • code in matlab 1. [2+1+1pt] Power Method and Inverse Iteration. (a) Implement the Power Method. Use...

    code in matlab 1. [2+1+1pt] Power Method and Inverse Iteration. (a) Implement the Power Method. Use your code to find an eigenvector of -2 1 4 A= 1 1 2 4 1 -2 starting with Xo = (1, 2, -1)7 and Xo = (1, 2, 1)7. Report the first 5 iterates for each of the two initial vectors. Then use MATLAB's eig(A) to examine the eigenvalues and eigenvectors of A. Where do the sequences converge to? Why do the limits...

  • SOLVE USING MATLAB ONLY AND SHOW FULL CODE. PLEASE TO SHOW TEXT BOOK SOLUTION. SOLVE PART D ONLY

    SOLVE USING MATLAB ONLY AND SHOW FULL CODE. PLEASE TO SHOW TEXT BOOK SOLUTION. SOLVE PART D ONLY Apply Euler's Method with step sizes h # 0.1 and h 0.01 to the initial value problems in Exercise 1. Plot the approximate solutions and the correct solution on [O, 1], and find the global truncation error at t-1. Is the reduction in error for h -0.01 consistent with the order of Euler's Method? REFERENCE: Apply the Euler's Method with step size...

  • Please solve using matlab and post the code used 1) Consider the following input data: x...

    Please solve using matlab and post the code used 1) Consider the following input data: x = [O 3.6 10 12 16.4 18.4 24]; y = [52 32.830 6.670 7 5.030 2*pi 8]; Use polyfit to a) determine the best polynomial fit for desired order n (1, 2, 3, 4, 5) b) determine the error between fitted and experimental data for the values of x c) determine the time to compute order range 0 to 6 using tic toc d)...

  • Please solve using MATLAB Example 1 Show that Example 2 Find a power series for the...

    Please solve using MATLAB Example 1 Show that Example 2 Find a power series for the rational fraction 2- 1 = 1 - + 2 1+ - 23+ 4 0 for 3 <1. Example 5 Find the Maclaurin series for (1+x)". Example 4 Find the Taylor series of the cubic function x3 about x = 3. Vectors in 3-Dimensional Space Find the distance between points P1=(3,-1,5)P1=(3,-1,5) and P2=(2,1,-1). Find the distance between points P1=(1,-5,4)P1=(1,-5,4) and P2=(4,-1,-1)P2=(4,-1,-1). (Ctrl)

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT