matrix corresponing to the minimum value of the difference
1 次查看(过去 30 天)
显示 更早的评论
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
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
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
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
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!