
Row vector divide by row vector
    18 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    Jimmy Zhan
 le 29 Juil 2020
  
    
    
    
    
    Modifié(e) : Bruno Luong
      
      
 le 31 Juil 2020
            Can anyone explain what is the mathematical operation for C = A/B where A and B are both row vectors?
>> A = [1 2 3 4]
>> B = [2 2 2 2]
>> C = A/B
C =
    1.2500
As you can see, C*B is not equal to A. This suggest that / is not a matrix right division. It almost looks like / is the average of elementwise division between two row vectors.
0 commentaires
Réponse acceptée
  Bruno Luong
      
      
 le 29 Juil 2020
        
      Modifié(e) : Bruno Luong
      
      
 le 29 Juil 2020
  
      It returns the scalar C (maxtrix 1x1) such that
C*B ~ A
in the sense that  
norm(C*B - A)^2  % or equivalently
sum((C*B - A).^2) 
is minimal.
Illustration:
>> sum((C*B-A).^2)
ans =
     5
>> sum(((C+0.1)*B-A).^2) % move on the right
ans =
    5.1600
>> sum(((C-0.1)*B-A).^2) % move on the left
ans =
    5.1600
>> ezplot(@(x) sum((x*B-A).^2), [-1 3]) % plot this function, that is a parabola minimum at x=1.25
>> xline(A/B)

1 commentaire
  Bruno Luong
      
      
 le 31 Juil 2020
				
      Modifié(e) : Bruno Luong
      
      
 le 31 Juil 2020
  
			If you want a direct formula, A/B is equal to (applicable for real and complex row vectors)
dot(B,A) / dot(B,B)
or
(A*B') / (B*B')
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Annotations dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

