Buch Cover Buch Cover Buch Cover Buch Cover

Web-Code: - Webcode Help

Parallelschaltung Ohm'scher Widerstände (Schleifen)

Werden Ohm'sche (elektrische) Widerstände (R1, R2, R3, R4, ...) parallel geschaltet, wird der Gesamtwiderstand R durch die folgende Formel berechnet:

R = {1\over{{1\over{R_1}} + {1\over{R_2}} + {1\over{R_3}} + ...}}

oder

R = 1/Rinv; Rinv = 1/R1 + 1/R2 + 1/R3 + 1/R4 + ...

Zunächst soll die Anwenderin eingeben können, wie viele Widerstände insgesamt zu erfassen sind. Danach werden alle Widerstände sukzessive eingelesen und die Teilsumme Rinv := 1/R1, Rinv := Rinv + 1/R2, Rinv := Rinv + 1/R3, ... jedes Mal um den neuen Kehrwert ergänzt. Zum Schluss wird der Anwenderin R := 1/Rinv (der Gesamtwiderstand) ausgegeben.

Prüfen Sie Ihre Lösung mit den Zahlen im Verifikationsteil.

 

0 Kommentare

Bitte melde dich an um einen Kommentar abzugeben

8 Lösung(en)

n = int(raw_input("Anzahl Widerstaende: "))
i = 1
rinv = 0.0
while (i <= n):
   r    = float(raw_input('Widerstand '+str(i)+' in Ohm :'))            
   rinv = rinv + 1/r
   i    = i + 1         
    
print'Der Gesamtwiderstand ist R_tot= ' + str(1/rinv) + ' Ohm'
                
import java.util.Scanner;


public class ParallelWiderstand {

  public static void main(String[] a) {
    new ParallelWiderstand().top();
  }

  void top() {
    int anzahl = eingabeAnzahl();
    float[] widerstaende;
    widerstaende = einlesenWiderstaende(anzahl);
    float resultat = berechungParallelWiderstand(widerstaende);
    ausgabeResultat(resultat);
  }

  void ausgabeResultat(float resultat) {
    System.out.println("Der Parallelwiderstand ist " + resultat);
  }

  float berechungParallelWiderstand(float[] widerstaende) {
    float result = 0;
    for(float act : widerstaende) {
      result = result + 1/act;
    }
    return 1/result;
  }

  float[] einlesenWiderstaende(int anzahl) {
    float[] widerstaende = new float[anzahl];
    for(int i = 1; i <= anzahl; i ++) {
      widerstaende[i-1] = eingabeEinzelwiderstand(i);
    }
    return widerstaende;
  }

  Scanner sc = new Scanner(System.in);
    
  float eingabeEinzelwiderstand(int i) {
    System.out.println("R " + i + ": ");
    return sc.nextFloat();
  }

  int eingabeAnzahl() {
    System.out.println("Geben Sie die Anzahl Ri ein:");
    return sc.nextInt();
  }

} // end ParallelWiderstand
                
package ch.twidner;

import java.util.Scanner;

public class Parallelschaltung {

	Scanner sc01 = new Scanner(System.in);
	float gesamtwiderstand;
	
	public static void main(String[] args) {
		new Parallelschaltung().top();

	}

	void top() {
		gesamtwiderstand = widerstaendeVerarbeiten("Anzahl Widerstände eingeben: ");
	    System.out.println("Gesamtwiderstand: " + (1 / gesamtwiderstand));
	}
	 
	float widerstaendeVerarbeiten(String aufforderung) {
		int   anzahlWiderstaende;
		float aktuellerWiderstand;
		float gesamtWiderstand  = 0;
		
		System.out.println(aufforderung);
		anzahlWiderstaende      = sc01.nextInt();
		
		for(int i = 1; i <= anzahlWiderstaende; i++) {
			System.out.println("Widerstand " + (i) + ": ");
			aktuellerWiderstand = sc01.nextFloat();
			gesamtWiderstand    = gesamtWiderstandBerechnen(aktuellerWiderstand, gesamtWiderstand);
		}
		
		return gesamtWiderstand;
	}
	
	float gesamtWiderstandBerechnen(float aktuellerWiderstand, float gesamtWiderstand) {		
		gesamtWiderstand += kehrwertBerechnen(aktuellerWiderstand);
		
		return gesamtWiderstand;
	}
	
	float kehrwertBerechnen(float widerstand) {
		return 1 / widerstand;
	}

}

                

Lösung von: Tobias Widner (Santis AG)

{$R+}
{$B+}

program BerechneWiderstand (input,output);
{ Eingabe Anzahl von Wiederstanden und Einzelnen Werte von Wiederstaenden}
{FernUni Hagen}
type
tW = 1..maxint;

var
Ergebnis : real;
Eingabe,
Anzahl : tW;
StartWert : integer;

begin
  StartWert :=1;
  Eingabe :=1;
  Ergebnis := 0;
  Anzahl := 1;
  write('Geben Sie die Anzahl von Wiederstaenden an: ');
  readln(Anzahl);
  for  StartWert := 1 to Anzahl  do
  begin
    write('Zahl nr ', StartWert,' eingeben: ');
    read(Eingabe);
    Ergebnis := Ergebnis + (1/Eingabe);
  end;
  Ergebnis := 1/Ergebnis;
  write('Gesamtwiederstand: ', Ergebnis:2:4, ' Ohm');
  read(); {Nur um die Konsole zu sehen}
end.

                

Lösung von: Name nicht veröffentlicht

function totalParallelResistance() {
  let sum = 0;
  for (let i = 0; i < arguments.length; i++) sum += 1 / arguments[i];
  return 1 / sum;
}

// ausgabe
console.log( totalParallelResistance(20, 30, 40, 50) );
console.log( totalParallelResistance(30, 30, 470, 1000, 2000) );
                

Lösung von: Lisa Salander (Heidi-Klum-Gymnasium Bottrop)

// NET 6.x | C# 10.x | VS-2022

static double ParaRes(params double[] r) => 1 / r.Select(x => 1 / x).Sum();
Console.WriteLine(ParaRes(20, 30, 40, 50));
Console.WriteLine(ParaRes(30, 30, 470, 1000, 2000));
                

Lösung von: Jens Kelm (@JKooP)

// C++ 14 | VS-2022

#include <iostream>
#include <vector>
#include <numeric>

double get_parallel_resistance(const std::vector<double>& v) {
    return 1.0 / std::accumulate(v.begin(), v.end(), 0.0, [](auto i, auto k) { return i + 1.0 / k; });
}

int main() {
    std::cout << get_parallel_resistance({ 20, 30, 40, 50 }) << "\n";
    std::cout << get_parallel_resistance({ 30, 30, 470, 1000, 2000 }) << "\n";
}
                

Lösung von: Jens Kelm (@JKooP)

// C++ 20
#include <iostream>

int main() {
    constexpr auto get_parallel_resistance{ [] <typename ...T>(const T& ...param) { return 1 / ((1.0 / param) + ...); } };
    std::cout << get_parallel_resistance(20, 30, 40, 50) << "\n";
    std::cout << get_parallel_resistance(30, 30, 470, 1000, 2000) << "\n";
}
                

Lösung von: Jens Kelm (@JKooP)

Verifikation/Checksumme:

Parallelschaltung von

  • 20, 30, 40 und 50 Ohm ergeben 7.7922... Ohm.
  • 30, 30, 470, 1000, 2000 Ohm ergeben 14.2259... Ohm.

Suchmaschinen wie www.wolframalpha.com und www.bing.com erlauben direkt die Eingabe der Formel: 1/R = 1/20 + 1/30 + 1/40 + 1/50

Aktionen

Bewertung

Durchschnittliche Bewertung:

Eigene Bewertung:
Bitte zuerst anmelden

Meta

Zeit: 1
Schwierigkeit: k.A.
Webcode: eisv-86s7
Autor: Philipp G. Freimann (BBW (Berufsbildungsschule Winterthur) https://www.bbw.ch)

Download PDF

Download ZIP

Zu Aufgabenblatt hinzufügen