hi every1!!! another question...how to write the MATLAB code according to this flowchart. its a CSD concept. I am not getting how to write MATALB code for the condition..PLz any help vill be appreaciated..M new to MATLAB so finding it difficult.

3 件のコメント

Walter Roberson
Walter Roberson 2015 年 11 月 3 日
That flow chart does not make sense to me. One of the boxes appears to be the action "Y> i = i+1" which does not make sense as an action.
Rutika Titre
Rutika Titre 2015 年 11 月 4 日
編集済み: Walter Roberson 2015 年 11 月 4 日
hello Sir,
After checking the position of A if A(i,j)=1 then Y=Y+B will shift to right side bit wise. A=[0 0 1 -1 0 1 -1 1] and B=[0-1 0 1 1 -1 0 1] and Y=0, i=0; after the shifting i increments. and if i<=n the program ends where n is the number of bits.
I hope now u can help me. i have tried a code vch i have written just for A(i,j)==1.but getting an error. How to shift bits to the right.Double type means what?
Plz plz help me out
Walter Roberson
Walter Roberson 2015 年 11 月 4 日
https://en.wikipedia.org/wiki/Canonical_signed_digit

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

 採用された回答

Rutika Titre
Rutika Titre 2015 年 11 月 4 日
編集済み: Walter Roberson 2015 年 11 月 4 日
A= [0 1 -1 0 -1 1 -1 0];
B= [0 1 0 1 -1 0 -1 1];
i=0;
Y=0;
n=1:8;
% Y=A.*B
% while(i==n)
if (A(1,:)==1)
Y=Y+B;
C1=bitshift(Y,1)
i=i+1;
end
if (A(1,:)==-1)
Y=Y-B;
C2=bitshift(Y,2)
i=i+1;
end
if(A(1,:)==0)
C3=bitshift(Y,3)
i=i+1;
else
break;
end
% % if (i<=n)
% break;
% end
% end
This is what i have tried

1 件のコメント

Rutika Titre
Rutika Titre 2015 年 11 月 5 日
Thank You Sir I have written my code and got the output. Thanks for giving your valuable time. Thanks gor your help

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

その他の回答 (1 件)

Rutika Titre
Rutika Titre 2015 年 11 月 3 日
Trying writing MATLAB code for this flowchart but still stuck up....Tried using for loops,while giving various condition but not getting output. To shift the result to right side if m uding bitslr not getting...Plz help me.

カテゴリ

ヘルプ センター および File Exchange で Instrument Control Toolbox Supported Hardware についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by