1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
icang [17]
2 years ago
15

Matlab In this assignment you will write a function that will calculate parallel resistance for up to 10 parallel resistors. Cal

l the function by ParallelR(Number), where Number is an integer between 1 and 10 which will be input from a command window prompt. Use a for loop Number times to find the Numerator and Denominator for parallel resistance. After the for loop you should find Solution as Num/Den. the number Solution will be returned by the function.

Computers and Technology
1 answer:
Ket [755]2 years ago
8 0

Answer:

The complete Matlab code along with step by step explanation is provided below.

Matlab Code:

function Req=ParallelR(Number)

Number=input('Please enter the number of resistors: ');

if Number>10 | Number<=0

   disp('Invalid input')

return

end

R=0;

for i=1:Number

r=input('Please enter the value of resistor: ');

R=R+1/r;

end

Req=1/R;

end

Explanation:

Parallel resistance is given by

\frac{1}{Req} = \frac{1}{R_{1}} + \frac{1}{R_{2}} + \frac{1}{R_{3}}...+\frac{1}{R_{N}}

First we get the input from the user for how many parallel resistors he want to calculate the resistance.

Then we check whether the user has entered correct number of resistors or not that is from 1 to 10 inclusive.

Then we run a for loop to get the resistance values of individual resistors.

Then we calculated the parallel resistance and keep on adding the resistance for N number of resistors.

Output:

Test 1:

Please enter the number of resistors: 3

Please enter the value of resistor: 10

Please enter the value of resistor: 20

Please enter the value of resistor: 30

ans =       60/11

Test 2:

Please enter the number of resistors: 11

Invalid input

Test 3:

Please enter the number of resistors: 0

Invalid input

You might be interested in
Here are the codes for producer and consumer problems.
melomori [17]

Answer:

If a switch happens during counter++ or counter--, we will get a wrong value for the counter.

Explanation:

counter++ counter--

register1 = counter register2 = counter

register1 = register1 + 1 register2 = register2 - 1

counter = register1 counter = register2

Lets consider this example, lets assume that counter=4, this simply means that there are 4 items which are produced already. Lets look at the following steps and value of counter after each step.

a) Producer process is updating counter++, this takes place at machine level, also, during that when it completed register1=counter counter=4

b) Supposing we have a context switch happen to consumer process and it is trying to update counter--, this takes place at machine level, also when it completed

register2=counter counter=4

register2=register2-1

counter=register2 counter=3

c) Lets assume that context switch happened back to producer process and it continues from where it stopped, look at step a

register1=register1+1

counter=register1 counter=5

This will make the value of counter variable to become 5. Consumption of one item is not reflected in the counter variable. To avoid this we need to allow the atomic execution of all these instructions. This implies completion of any updates on the counter, while others wait for its completion.

d) In the event a producer executes all these machine level instructions at once,then there is no inconsistency on this.

3 0
2 years ago
One limitation of high-level programming languages is
faltersainse [42]

Answer:

One limitation of high-level programming languages is It takes additional translation times to translate the source to machine code

<em>High level programs are comparatively slower than low level programs. Compared to low level programs, they are generally less memory efficient. Cannot communicate directly with the hardware.</em>

4 0
3 years ago
Favorite color should it be stored why?or why not?<br>​
Triss [41]

Answer:

Explanation:

green

8 0
2 years ago
1.where should the name of the website or company logo appear on a website
Paul [167]

Answer:

1. First Page

2. Two Colors

8 0
3 years ago
Read 2 more answers
Write a Java program that prompts the user to enter integer values for the sides of a triangle and then displays the values and
satela [25.4K]

Answer:

import java.util.Scanner;

public class triangle {

       public static void main (String [] args) {

           int sideOne, sideTwo, sideThree;

           Scanner in = new Scanner (System.in);

           System.out.println("Enter the first side of the triangle");

           sideOne = in.nextInt();

           System.out.println("Enter the secon side of the triangle");

           sideTwo = in.nextInt();

           System.out.println("Enter the third side of the triangle");

           sideThree = in.nextInt();

           if ( sideOne<=0||sideTwo<=0|| sideThree<=0){

               System.out.println(" The Values enter are "+sideOne+ "," +sideThree+ ","+sideThree+ " These values don't make a valid triangle");

           }

           else if ((sideOne + sideTwo> sideThree) || (sideOne+sideThree > sideTwo) || (sideThree+sideTwo > sideOne))

           {

               System.out.println ("The triangle is Valid");

           }

           else {

               System.out.println(" The Values enter are "+sideOne+ "," +sideTwo+ ","+sideThree+ " These values don't make a valid triangle");

           }

       }

Explanation:

for a Triangle to be Valid one of the three sides of the triangle must greater than the other two sides.  The code above enforces this condition using an if statement in combination with the Or Operator

The following conditions where enforced

side one, side two and side three != 0

Side One + Side Three > Side Two

Side Three + Side Two> Side One

Side Two + Side One > Side Three

7 0
3 years ago
Other questions:
  • Chris needs to modify the default bullets that are used in a nonnumbered list in word. Which method should he use?
    9·2 answers
  • Multiple Choice
    6·1 answer
  • What is the relationship between a method and a function
    11·2 answers
  • What feature of Windows Server allows for agentless authentication?
    7·1 answer
  • All states that have altered judicial selection techniques in recent years have adopted some form of:
    5·1 answer
  • What happens when you call someone whose phone is off?
    6·2 answers
  • The study of a current business and information system application and the definition of user requirements and priorities for a
    5·1 answer
  • Universal containers set the organization-wide defaults for cases to private. When a case is escalated, case ownership changes t
    13·1 answer
  • The ______ engine compares your entry against its database and returns a list of hits or sites that contain the keywords. (hint:
    8·1 answer
  • Range paramters - for loop<br> question in picture
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!