求教如何实现累乘方程。

조회 수: 11 (최근 30일)
sitako
sitako 2022년 11월 22일
답변: madoka 2022년 11월 22일
请问各位朋友,如何在MATLAB下实现y=x1*x2*x3*x4*x5
我的代码如下,无法运算,麻烦各位赐教。
n = 100;
x=1+(5-1).*rand(6,n)
y(1,:)=x(1,:)*x(2,:)*x(3,:)*x(4,:)*x(5,:)
我这样无法求解y,请问该如何编写呢?

채택된 답변

madoka
madoka 2022년 11월 22일
%% 清空环境变量
close all; clear; clc;
%% 主程序
n = 100;
x = 1+(5-1).*rand(6,n)
y = x(1,:).*x(2,:).*x(3,:).*x(4,:).*x(5,:)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!