MATLAB中的两个变量相乘怎么编写?

2025-02-24 11:38:37
推荐回答(4个)
回答1:

t=0:0.1:5*pi;                   %范围

y=exp(-t/4).*sin(3*t);          %注意中间是.*

y0=exp(-t/4);                   %两条包络线

y1=-y0;

plot(t,y, '+r', t, y0, '-b', t, y1, '-b');

回答2:

如果t是一个值,写为sin(t)*(e^t)就ok
如果t矩阵,那么要写为sin(t).*(e^t)

回答3:

代码验证成功,可以运行
x=rand(3,4);
y=rand(4,5);

[row1, col1] = size(x);
[row2, col2] = size(y);

if col1 ~= row2
disp('input is error');
else
result = zeros(row1, col2);
for ii=1:row1
for jj=1:col2

result(ii,jj) = sum(sum(x(ii,:) .* (y(:, jj))' ));
end
end

end

回答4:

z=x.*y?
你是这个意思吗?