Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Matlab coding problem. What needs to be changed here to pass all the pretests? Here is my coding and the error message. Your Function 1

Matlab coding problem. What needs to be changed here to pass all the pretests?

Here is my coding and the error message.

image text in transcribed

image text in transcribed

Your Function 1 function [V_mp, V_mp_residual] - student_solution(T, v_oc, v_ mp_guess, es) 2 3 q1.6022e-19; 4 k_B 1.3806e-23; n = length (T); 7 options - optimset('Tolx',es); for i = 1:1:n le fun = (@)(x) exp(0%/(k-B*T(1)))"(1+4*x/(k-B *T(1)))-expCq"V OC/ (k-B*T(1))); 11 12 V, mp (i) = fzero(fun, x0, options); 13 V-mp-residual(1)=fun (V-mp(1)); 14 end 15 16 end xo = V mp-guess(1); Test 3 (Pretest) Index exceeds the number of array elements (1). Error in student_solution (line 12) x0 V_mp_guess(ii); Error in Test3 (line 5) [student_sol1, student_so121 student_solution(260:2:320, 0.6, 0.6, 1e-8) Test Code: 1%third test case (vector input, checking root estimates and residual 2 %values) 3Ty-correcti, y_correct2] PA3-solar(260 : 2: 320, o.6, 0.6, 1e-8); 4 [y_correct1_alt, y_correct2_alt] - PA3_solar_alt (260:2:320, 0.6, 0.6, 1e-8) 5 [student_sol1, student_sol2] - student_solution (260:2:320, 0.6, 0.6, 1e-8); 6 test vector length 7 assert(isequal (size (student_sol1),size( y_correct1)), 'output 1 should be a 31x1 column vector for this test case 8 assert(isequal(size(student_sol2),size( y_correct2)), 'output 2 should be a 31x1 column vector for this test case') 9%test accuracy 10 test1max (abs((y_correct1 - student_sol1)./y_correct1)) 11 assert(le(test1,1e-7), 'One or more values in output 1 is numerically incorrect') 12 test2max (abs (y_correct2 - student_sol2)./y_correct2); 13test2-alt-max(abs((y-correct-alt - student-so12) ./-correct2alt)); 14 assert(test23-1e-4 test2 alt

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions