matrix corresponing to the minimum value of the difference

1 Ansicht (letzte 30 Tage)
JAGADEESH JAGA
JAGADEESH JAGA am 2 Feb. 2017
Kommentiert: Walter Roberson am 3 Feb. 2017
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 Kommentare
Stephen23
Stephen23 am 2 Feb. 2017
Bearbeitet: Stephen23 am 2 Feb. 2017
@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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Niels
Niels am 2 Feb. 2017
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 Kommentar
Niels
Niels am 3 Feb. 2017
Bearbeitet: Niels am 3 Feb. 2017
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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by