
How to plot two function multiplied by each other.
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I am attepmting to plot the functions below. I recieve the error,
"Error using *
Incorrect dimensions for matrix multiplication.
Check that the number of columns in the first
matrix matches the number of rows in the second
matrix. To perform elementwise multiplication,
use '.*'.
And then when I try to add the dot between my products I still recieve the error. What is the problem?
a=0;
b=3;
N=10000;
h=(b-a)/N;
t=a:h:b;
x=2000*sind(120*pi*t)*exp(-180*t)
plot(t,x)
Risposte (1)
Srivardhan Gadila
il 30 Apr 2020
The output of sind(120*pi*t) & exp(-180*t) are vectors of size equal to size(t) = 1x10001.
Hence as the error indicates you to check the dimensions of matrix multiplication.
You have to use .* instead of * for element wise multiplication between two vectors having same shape.
x=2000*sind(120*pi*t).*exp(-180*t)
Refer to times, .*
0 Commenti
Vedere anche
Categorie
Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!