What is the difference between `*`

and `.*`

in Matlab?

`*`

is matrix multiplication while `.*`

is elementwise multiplication.

In order to use the first operator, the operands should obey matrix multiplication rules in terms of size.

For the second operator vector lengths(vertical or horizontal directions may differ) or matrix sizes should be equal for elementwise multiplication

`*`

is a vector or matrix multiplication `.*`

is a element wise multiplication

```
a = [ 1; 2]; % column vector
b = [ 3 4]; % row vector
a*b
ans =
3 4
6 8
```

while

```
a.*b.' % .' means tranpose
ans =
3
8
```

Similar Questions

What is the difference between split(\\W) and split([^\\w']) ?

What is the difference between scale and zoom? What is the definition of scale? and What setInitialScale function does?

What is the difference between signed and unsigned int?

I've been reading in the last couple of days about touch devices and events. I've seen lots of scripts that make difference between webkit and mozilla touch events? What is the main difference between

What is the difference between varchar and varchar2?

What is the difference between the 'conv' and 'fftfilt' functions in MATLAB? I read that conv is done in time-domain, while fftfilt first does FFT using the overlap-add method before doing the multip

What is the difference between the defn and defmacro ? What is the difference between a function and a macro ?

In applying the laplacian to an image,What is the difference between fspecial('laplacian', alpha) and L= del2(U) Do they do the same operation on image?

What is the difference between URLLoader and URLRequest in Actionscript?

What is the difference between business class and domain class? What is meant by persistent classes?

In FileSystemObject, what is the difference between GetFolder and GetParentFolderName?

What is the fundamental difference between quicksort and tuned quicksort? What is the improvement given to quicksort? How does Java decide to use this instead of merge sort?

What is the difference between sorting and topological-sorting? Are they same or different thing?

What is the difference between the KeyDown and KeyPress events in .NET?

what is difference between .net 4.0 MemoryCache vs ObjectCache? Where to use which object?

What is the difference between Microsoft AJAx and AJAX Pro? Also, for what should I use AJAX Pro?

What is the difference between required and ng-required (form validation)?

What is the difference between BeginConnect and ConnectAsync? Subsequently, what is the difference between BeginDisconnect and DisconnectAsync? The ConnectAsync documentation states: Begins an asyn

What is difference between setFlags and addFlags for intent. Could any one explain it please. Help Appreciated.

What is the difference between the :focus and :active pseudo-classes?

What's the big picture difference between observers and callbacks? When and where to use which one?

What is the difference between TopLink Essentials & EclipseLink, both originates from Oracle ?

What is the difference between Protocols or Delegates and NSNotifications? What is an Observer and how does it work?

Why are there 2 different ways lock memory in place in .NET? What is the difference between them?

if tf < max(arr) Vs. if all(tf < max(arr)) what is the difference between them which one is recommended. are they exactly equivalent? I get an error when using matlab coder with the first one

Very simple question, but i am confused in it. Can anybody explain Is there any difference between Matlab histeq() function and Opencv cv::equalizeHist() function. As i am trying to apply histogram eq

What is the difference between the const and immutable type qualifiers in D?

What is the difference between these two approaches? I am trying to understand Jquery and JavaScript better. Thanks in advance SO! /** * What is the difference between these two techniques? */ /* Usi

What is the difference between prints in python: print 'smth' print('smth')

What is the difference between the & and && logical operators in MATLAB?

What is difference between <init> and <clinit> in Java ? I am unable to understand the following text.. Does it mean for empty constructors? Why is important to have two different versions

I've always wondered what the difference between them were. They all seem to do the same thing...

What is difference between windows drivers and linux drivers? Are they written in the same languages?

I have a very simple question - Difference between NULL and empty matrices in MATLAB? NULL CASE: a = null(1) --> a is 1x0 matrix EMPTY CASE: a = [] --> a is 0x0 matrix Thanks!

I have been going through some jQuery functionality. Can any one please give me some idea of what the difference is between the use of $ and $$?

What is the difference between design patterns and architectural patter? How they are different? What are different types of Architectural patterns?

What is the difference between linear and relative layout?

What is difference between Device Camera & Main Camera? What is use of Device Camera Plane in Device Camera? At the time of tracking which camera is used?

Simply, what is the difference between HybridHttpOrThreadLocalScoped & HttpContextScoped?

What is the difference between JPF (Apache netUI) and Struts? When should I use JPF in web applications? What are the pros and cons about JPF?

What is the difference between pure and impure in haskell? When doing IO in haskell, what does it mean to keep the pure and impure items separate?

What is the difference between Join and Union? Can I get a sample?

What is the difference between these calls?

Another newbie question. I just wanted to know what exactly is the difference between html and htm extensions we see for webpages. Are they same? and if so then why two extensions for the same purpose

I am little bit confused about the difference between a service and component. Can someone explain with example that what is the difference between a service and component?

What is the difference between boxing/unboxing and type casting? Often, the terms seem to be used interchangeably.

What is the difference between px and em?

What is the difference between JAAS and JAAP ? JAAS: Java Authentication and Authorization Service JAAP: ??

In case of the Proxy Design Pattern, What is the difference between JDK's Dynamic Proxy and third party dynamic code generation API s such as CGLib? What is the difference between using both the appr

Given these two Regex: (?!^)\G and \G(?!^) What's the difference between negative lookahead after and before \G anchor?