Could you please Help code this in MatLAB ? Background : After numerous experime
ID: 2081748 • Letter: C
Question
Could you please Help code this in MatLAB ?
Background : After numerous experiments with a circuit configuration , you determined that as long as the transistor chosen meets certain criteria , other components in the circuit can be adjusted to yield an ideal frequency response .In the classification diagram shown below , there are two regions where the transistor is acceptable .
Zone A , shown in solid magenta lines , is defined as :
- a horizontal line at 7500 Hz for voltages from 0 to 3 V ;
- a linear line from (3 ,7500) to ( 6,9000) ;
- a vertical line at 6 V for a frequency from 6000 to 9000 Hz ;
- a power law curve which extends to ( 6 ,6000) , passing through the points (0.15 , 1000 ) and ( 3 ,4244 ).
Zone B, shown in blue dashed line segments defined as :
- a horizontal line at 7500 Hz for voltages from 12 to 15 V ;
- a vertical line at 8 V for a frequency from 0 to 3000 Hz ; and
- an exponential curve which extends from ( 8 ,3000 ) to ( 12 ,75000) , passing through the point ( 11 ,6000).
If a point falls on a line dividing the "Accept" and "Reject" regions , is it considered acceptable .Create the classification diagram , duplicating the diagram exactly shown . All the lines should have a linewidth of 3 . Accept region labels should be in size 16 font , while the Reject region labels will be in size 20 font .
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The user will be allowed to repetitively specify a pair of experimental test values for a specific transistor and store the response in the two-element vector Test . The first value in Test is the voltage and the second value is the measured frequency . Check if the user has entered a two-element row vector . If the user has entered an incorrect number of elements , give the user two more chances to enter the correct number of elements .If the user fails to enter a matrix correctly with three total tries ( the first try + two additional tries ) , terminate the program.
As long as the user enters a 2 -element row vector and a voltage value as the first element in Test with the range of 0 and 15 volts inclusive , the program will follow these steps , if not the program will throw a warning for the user and loop them back to the beginning of the program .
- the user enter a set of numbers .
- The program checks for the shape of the data entered .If the user does not enter a 1 x 2 vector within three times , the program will terminate [see information above ].
- The program checks that the voltage entered is betweeen 0 and 15 V and the Frequency is between 0 and 10000 Hz . If the user does not enter an approciate value , ask the user to replace the value that is outside the specified range .
- The program will store the values of V and f for each date entry .
- The program will determine if the V , f pair entered by the user is Accepted or Rejected :
- If the test value lies in a " Accept" region , the program will store the text " Accept Device in Zone # " in a variable ,where # is replaced by the letter A or B depending on the Zone the point is lies in .
- If the test value is anywhere outside an " Accept " region , the text " Reject Device " is stored in the variable .
- The point is added to the classification diagram as a size 20 red , solid cirlce . The center of the circle should contain the point number entered by the user ( 1 for first point , 2 for second point , etc. )
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The user is asked to enter another pair (using the menu ) .If yes , the user is promted to enter another pair . If no , the program will print the results in tabular format . similar to the table shown below . It will also report the number of points accepted and number of points rejected that were entered by the user .
Sample Output (Test Cases) to Command Window
Your tests resulted in :
6 Accepted Devices
4 Rejected Devices
Entry # | Voltage [V] | Frequency [Hz] | Statues
1 2 1000 Reject Device
2 11 5000 Accept Device in Zone B
3 9 1000 Accept Device in Zone B
4 5 8000 Accept Device in Zone A
5 13 8000 Reject Device
6 4 9000 Reject Device
7 10 7000 Reject Device
8 1 5000 Accept Device in Zone A
9 6 5000 Recject Device
10 3 3000 Reject Device
configuration, you determined that as long as the transistor circuit can be adjusted to yield an ideal frequency response. o regions where the transistor is acceptable. 9000 Reject Zone A Accept Zone B Reject Accept 11 13 15 voltage (v)IVI t" regions, it is considered acceptable. Create the as shown. All lines should have a linewidth of 3. Accept Ado Easily PDF d Fill Send SendExplanation / Answer
/* File: findrange.c */ /* IND = findrange(A,L,U) returns the same result as the following: */ /* IND = find(A(:,1)>=L & A(:,1) 1 ) { mexErrMsgTxt("Too many outputs."); } if( nrhs != 3 ) { mexErrMsgTxt("Need exactly 3 inputs."); } if( !mxIsDouble(prhs[0]) || mxIsSparse(prhs[0]) || mxGetNumberOfDimensions(prhs[0]) > 2 ) { mexErrMsgTxt("First argument must be full double 2D matrix."); } if( !mxIsNumeric(prhs[1]) || mxGetNumberOfElements(prhs[1]) != 1 ) { mexErrMsgTxt("2nd argument must be a scalar."); } if( !mxIsNumeric(prhs[2]) || mxGetNumberOfElements(prhs[2]) != 1 ) { mexErrMsgTxt("3rd argument must be a scalar."); } L = mxGetScalar(prhs[1]); U = mxGetScalar(prhs[2]); pr = mxGetPr(prhs[0]); m = mxGetM(prhs[0]); plhs[0] = mxCreateDoubleMatrix(m,1,mxREAL); ind = mxGetPr(plhs[0]); for( i=0; i= L && *prRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.