Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help in Matlab. urgent. Here is my Program. I don;t know where is the problem . I have mention the error in the
I need help in Matlab. urgent.
Here is my Program. I don;t know where is the problem . I have mention the error in the last in red checkbox. Please help me .
Thank you.
1 %% Variables 2 inputs 3 % d-distance from the light [m] 4 % RA-Resistance of photoresistor A 5 % RB - Resistance of photoresistor B 6 % RC -Resistance of photoresistor C 8 Start wrting your program here 9 % Enter data to be plotted 10 R1- [79,400,1100,2500]; 11 R2- [150,840,2500,4900]; 12 R3- [460,2500,6900,15000]; 13 d [1,3,6,10]; 14 figure('color', 'w') 15% Create plot here including au proper plot commands here 16 p = plot (d ,R1 ,'-k',d,R2,.--r',d,R3,'-.b'); % your plot command here for au experimental data sets 17 axis([1 10 10 15000]) 18 % Add your legend here 9 eg1, leg2, leg3, leg4] legend ( 'Photo resistor 1 actual', 'Photo resistor 2 actual, 'Photo resistor 3 actual') 20 21 % Calculate trendline parameters and plot trendline 22 RAfit -polyfit(log ( d), log (RI), 1) ; % polyfit for resistance of photoresistor A 23 m-RA- RAfit (1); % polyfit slope for resistance of photo resistor A 24 b-RA- 10^RAfit ( 2); % polyfit y-intercept for resistance of photoresistor A 25 26 RBfit polyfit(log ( d),log (R2), 1); % polyfit for resistance of photoresistor B 27 m-RB = RBfit(1); % polyfit slope for resistance of photoresistor B 28 b-RB- 10^RBfit ( 2); % polyfit y-intercept for resistance of photoresistor B 29 0 Rcfit polyfit (log ( d), log (R3), 1); % polyfit for resistance of photoresistor C 31 m_RC- Rcfit (1); % polyfit slope for resistance of photoresistor C 32 b-RC 10-qcfit ( 2 ); % polyfit y-intercept for resistance of photoresistor C % Calculate trendlines % distance range for polyfit plots RApf b-RA*d."m-RA; % Data to be plotted for resistance of photoresistor A RBpf = b-RB*d."m_AB; % Data to be plotted for resistance of photoresistor B RCpf = b_ACxd.^m-RC ; % Data to be plotted for resistance of photoresistor C hold on % Plot trendlines here for au data sets r plot(d, RApf,d, RBpf,d, RCpf) xlabel ( 'Distance from light source in m') ylabel('Resistance in ohms') grid % Print equations for trendline here TE1-sprintf 'R-%5.1f d%5.2f ,b_RA,m_RA) text (7,800,TE11) TE2-sprintf( 'R-%5.1f d%5.2f',b_RB, m RB) text (7,3000, TE2) TE3-sprintf('Rz85.1f text ( 6 , 6000 , TE3 ) d^85 . 2f.b-RC , m-RC) 3 Marker Symbol Check Marker symbols for different data sets should be different Marker symbols for different data sets should be different. Color Check Line Style Check Assertion failed. Incorrect line type for one or more of the trendlines. Proper Plot Elements Photoresistor A Slope Check Photoresistor B Slope Check Photoresistor C Slope Check Photoresistor A Y-Intercept Check Variable b_RA has an incorrect value. Check your data and calculation of the y-intercept for photoresistor A. Photoresistor A Y-Intercept Check Variable b_RA has an incorrect value. Check your data and calculation of the y-intercept for photoresistor A. 3 Photoresistor Variable bRB has an incorrect value B Y-intercept Check Check your data and calculation of the y-intercept for photoresistor B. 3 Photoresistor C Y-Intercept Check Variable b_RC has an incorrect value. Check your data and calculation of the y-intercept for photoresistor C 1 %% Variables 2 inputs 3 % d-distance from the light [m] 4 % RA-Resistance of photoresistor A 5 % RB - Resistance of photoresistor B 6 % RC -Resistance of photoresistor C 8 Start wrting your program here 9 % Enter data to be plotted 10 R1- [79,400,1100,2500]; 11 R2- [150,840,2500,4900]; 12 R3- [460,2500,6900,15000]; 13 d [1,3,6,10]; 14 figure('color', 'w') 15% Create plot here including au proper plot commands here 16 p = plot (d ,R1 ,'-k',d,R2,.--r',d,R3,'-.b'); % your plot command here for au experimental data sets 17 axis([1 10 10 15000]) 18 % Add your legend here 9 eg1, leg2, leg3, leg4] legend ( 'Photo resistor 1 actual', 'Photo resistor 2 actual, 'Photo resistor 3 actual') 20 21 % Calculate trendline parameters and plot trendline 22 RAfit -polyfit(log ( d), log (RI), 1) ; % polyfit for resistance of photoresistor A 23 m-RA- RAfit (1); % polyfit slope for resistance of photo resistor A 24 b-RA- 10^RAfit ( 2); % polyfit y-intercept for resistance of photoresistor A 25 26 RBfit polyfit(log ( d),log (R2), 1); % polyfit for resistance of photoresistor B 27 m-RB = RBfit(1); % polyfit slope for resistance of photoresistor B 28 b-RB- 10^RBfit ( 2); % polyfit y-intercept for resistance of photoresistor B 29 0 Rcfit polyfit (log ( d), log (R3), 1); % polyfit for resistance of photoresistor C 31 m_RC- Rcfit (1); % polyfit slope for resistance of photoresistor C 32 b-RC 10-qcfit ( 2 ); % polyfit y-intercept for resistance of photoresistor C % Calculate trendlines % distance range for polyfit plots RApf b-RA*d."m-RA; % Data to be plotted for resistance of photoresistor A RBpf = b-RB*d."m_AB; % Data to be plotted for resistance of photoresistor B RCpf = b_ACxd.^m-RC ; % Data to be plotted for resistance of photoresistor C hold on % Plot trendlines here for au data sets r plot(d, RApf,d, RBpf,d, RCpf) xlabel ( 'Distance from light source in m') ylabel('Resistance in ohms') grid % Print equations for trendline here TE1-sprintf 'R-%5.1f d%5.2f ,b_RA,m_RA) text (7,800,TE11) TE2-sprintf( 'R-%5.1f d%5.2f',b_RB, m RB) text (7,3000, TE2) TE3-sprintf('Rz85.1f text ( 6 , 6000 , TE3 ) d^85 . 2f.b-RC , m-RC) 3 Marker Symbol Check Marker symbols for different data sets should be different Marker symbols for different data sets should be different. Color Check Line Style Check Assertion failed. Incorrect line type for one or more of the trendlines. Proper Plot Elements Photoresistor A Slope Check Photoresistor B Slope Check Photoresistor C Slope Check Photoresistor A Y-Intercept Check Variable b_RA has an incorrect value. Check your data and calculation of the y-intercept for photoresistor A. Photoresistor A Y-Intercept Check Variable b_RA has an incorrect value. Check your data and calculation of the y-intercept for photoresistor A. 3 Photoresistor Variable bRB has an incorrect value B Y-intercept Check Check your data and calculation of the y-intercept for photoresistor B. 3 Photoresistor C Y-Intercept Check Variable b_RC has an incorrect value. Check your data and calculation of the y-intercept for photoresistor CStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started