matrix corresponing to the minimum value of the difference

1 回表示 (過去 30 日間)
JAGADEESH JAGA
JAGADEESH JAGA 2017 年 2 月 2 日
コメント済み: Walter Roberson 2017 年 2 月 3 日
m=2
t=[1 0 0; 0 (1/sqrt(2)) (1/sqrt(2))];
v1=0.956
v2=2.4
a=[ 0 1 0];
b=[0 1 1];
p=b-a;
d1=m*a;
for x=1:1:m+1
c=d1+p*(x-1)
f=transpose(c);
vndq=t*c;
vnq=vndq(1,1)
vnd=vndq(2,1)
d(x)=abs(v2-vnq)+abs(v1-vnd)
n=min(d)
end
In the given code minimum value of d matrix corresponding c matrix
  4 件のコメント
Stephen23
Stephen23 2017 年 2 月 2 日
編集済み: Stephen23 2017 年 2 月 2 日
@JAGADEESH JAGA: it is not the capitals in the code, but the capitals in the English that is the problem: on most forums this is considered to be "shouting", and is not very polite (do an internet search):
Communicating on an online forum is just like real life: the more polite and considerate you are, the more help you will receive.

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

回答 (1 件)

Niels
Niels 2017 年 2 月 2 日
DEAR CAPTAIN CAPSLOCK
CANT READ YOUR CODE. BUT PEOPLE CONTINUE USING COMMANDS WITHOUT READING THE DOCUMENTATION. TRY MIN(D(:)) OR MIN(MIN(D)). THIS WILL PROBABLY NOT WORK SINCE YOU WOULD HAVE TO DEACTIVATE CAPS LOCK
  1 件のコメント
Niels
Niels 2017 年 2 月 3 日
編集済み: Niels 2017 年 2 月 3 日
About editing your question. It was all about the sentence after your code which is still unreadable since you did not use {}code. In your for loop you overwrite c 2 times. Hence c is a vector and no matrix. Preallocate c as 3x3 array
c=zeros(3,3); for i=1:m-1 c(i,:)=... end MinimumOfaMatrix=min(c(:));
Dont use x as index pls... and maybe add a question

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

カテゴリ

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