how i start?

1 回表示 (過去 30 日間)
shamsa khalid
shamsa khalid 2022 年 4 月 8 日
編集済み: Rik 2022 年 4 月 8 日

回答 (1 件)

Sam Chak
Sam Chak 2022 年 4 月 8 日
編集済み: Sam Chak 2022 年 4 月 8 日
@shamsa khalid
I'll give a general idea. You need to search some functions on the help documentation.
The chart is essentially a table. Perhaps you can create a table and then write a function to do the following:
  1. Request user input for the 4-band color code. (See https://www.mathworks.com/help/matlab/ref/input.html)
  2. identity the 4-band color code in the standard RGB
  3. lookup the corresponding values from the table
  4. determine the resistance of the resistor.
  5. display the result (see https://www.mathworks.com/help/matlab/ref/fprintf.html)
  2 件のコメント
shamsa khalid
shamsa khalid 2022 年 4 月 8 日
編集済み: Rik 2022 年 4 月 8 日
prompt = "Enter band 1 ";
a = input(prompt)
prompt = "Enter band 2 ";
b = input(prompt)
prompt = "Enter band 3 ";
c = input(prompt)
prompt = "Enter band 4 ";
d = input(prompt)
Sam Chak
Sam Chak 2022 年 4 月 8 日
After giving some thoughts, I think RGB values and the table are not needed in your case. If the color band is Brown, Orange, Green, Gold, then you can display an image and ask the user to enter accordingly:
code = [1 3 5 G]
and hit 'Enter'. The algorithm should determine and display the resistance as:
Ohm with % tolerance.
Note that Band #3 Black should be 0 because .

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by