convert algorithm to matlab code

4 ビュー (過去 30 日間)
Josaiah Ang
Josaiah Ang 2015 年 5 月 24 日
コメント済み: Walter Roberson 2021 年 8 月 19 日
hi,
how do i write a matlab code to display armstrong number between two number input by user
Thank you.
Interger :: a, b, c
Interger :: abc, a3b3c3
Interger ::count
count =0
DO a = 0, 9
DO b = 0, 9
DO c = 0, 9
abc= a*100 + b*10 + c
a3b3c3 = a*3 + b*3 + c*3 !
IF (abc == a3b3c3) THEN
count = count + 1
WRITE(',') 'Armstrong number ', Count, ': ', abc
End If
End DO
End DO
End DO
  2 件のコメント
Dilsher Mzuri
Dilsher Mzuri 2018 年 10 月 13 日
編集済み: Walter Roberson 2018 年 10 月 15 日
hi everyone :
1- start
2- read image(a)
3- r=a
4- (n,k)=size(a);L=n*k
5- num=number of times for each pixel
6- pdf=num/(L-1)
7- cdf=sum(pdf)
8- s=sum((L-1)*cdf)
8- m=s+r
9- end
Algorithm of EHE method
the algorithm above is converted to matlab code
best rregards
Walter Roberson
Walter Roberson 2018 年 10 月 15 日
Dilsher Mzuri: I am not sure if that is a question or a response?

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

回答 (3 件)

Walter Roberson
Walter Roberson 2015 年 5 月 24 日

sunnia ikram
sunnia ikram 2021 年 1 月 28 日
please send me code of A* algorithem in matlab....for obstacle detection
  1 件のコメント
Walter Roberson
Walter Roberson 2021 年 1 月 28 日
That is not an Answer to the question.

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


Venkata Naga Sai Krishna Immadisetty
Venkata Naga Sai Krishna Immadisetty 2021 年 8 月 19 日
clc
clear all
clear canvas
n = -10:10;
figure(2);
a_values = [0.9,1.1,-0.9,-1.1];
for i=1:length(a_values)
fun = a_values(i).^n;
subplot(2,2,i)
stem(n,fun);
xlabel("Time samples")
ylabel("Amplitute")
title("a^n for a = (19BEC0668)"+a_values(i))
end
  1 件のコメント
Walter Roberson
Walter Roberson 2021 年 8 月 19 日
Please explain how this algorithm finds 3-digit Armstrong Numbers ?

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by