Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is a matlab coding question. Please add comment statements for each section

ID: 3812176 • Letter: T

Question

This is a matlab coding question. Please add comment statements for each section of coding. Thanks

Solarpower.txt:

30   49.71118281
84   50.13527543
329   50.71213969
1262   49.74544833
1422   49.52951582
1258   49.73148162
876   49.04596383
1062   49.57108146
575   49.84275676
1444   50.03988176
367   49.94450869
1330   50.53186162
356   50.09510639
713   50.57819344
1210   50.27146073
1508   51.56990958
157   49.37088431
1794   50.45809592
1497   49.77358175
939   50.52212398
840   50.51671979
861   49.0981612
590   49.84547246
979   48.74631817
983   50.34960471
1572   50.27907511
1527   49.71567162
1238   50.70672101
727   50.47461989
1557   49.08507989
1022   50.34579629
672   49.34585158
1799   51.3191522
1677   49.97166714
1053   51
1191   49.63019911
1122   50.51280703
397   49.94537163
576   49.24089573
899   49.14554557
440   50.53288483
1610   49.95224907
372   49.02670316
431   49.45505067
325   50.21708043
434   49.13607346
829   50.8482067
592   49.44258273
1754   50.57371048
817   49.06051636
351   50.17329482
1716   48.67670689
1857   49.37044092
832   49.48387223
211   50.34916262
489   50.81965599
773   50.26142279
1125   49.67542853
496   50.709475
1139   50.69503168
1343   50.1045786
419   50.49698544
222   50.35913253
559   49.14134316
601   50.66082444
799   49.42823487
956   49.47459092

Problem 2 Background Consistency plays an important role in manufacturing to ensure a consumers receive the same product that will operate as intended. Problem Statement You are an electrical engineer working on designing and testing a new solar panel that could prove to be cheaper and more efficient than those currently in production. You have been tasked with examining 120 solar panels to check their power output and make sure it is within company specifications. The desired power output of a single 0.25 m solar panel is 50 Watts. There is a data set with two columns called solar power.txt. The first column is the panel ID barcode. The second column i the power output in watts. Your manager has specified that a solar panels falling outside the required power generation range of 49 to 51 Watts should be pulled out of the lot and inspected further. In the script file, perform the following tasks: Load the power outputs from solar power.txt. Determine and print out the ID number and power output of any solar panels that fall outside the acceptable minimum and maximum for power generation. You must use If/else statements for this.

Explanation / Answer

fileID = fopen('solar_power.txt','r');

sizeData = [2 Inf]; %Inf indicate infinite, which means read infinite data till file ends, and 2 means we have 2 data per line

Data = fscanf(fileID,'%d %f',sizeData); %read the complete file in one go

fclose(fileID);

[row col] = size(Data); %get actual number of data read

for i = 1:col

    if Data(2,i) >51 || Data(2,i) < 49 %if data is out of range

       printf("%d %f ", Data(1,i), Data(2,i)); %print them

    end

end

I hope that you like the code. Let me know if you are facing any difficulty. I shall be happy to help :)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote