
How to plot two function multiplied by each other.
조회 수: 8 (최근 30일)
이전 댓글 표시
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)
답변 (1개)
Srivardhan Gadila
2020년 4월 30일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!