필터 지우기
필터 지우기

How do I declare E=[1,-7,3,-9,5]

조회 수: 1 (최근 30일)
Reynaldo Ponce
Reynaldo Ponce 2019년 2월 25일
답변: Bob Thompson 2019년 2월 25일
for an assignment I was given
  1. Declare and suppress the output of the following variables in the most succinct manner possible:
A=[1,2,3,4,5]
B=[2,5,8,11,14]
C=[20, 15, 10, 5, 0]
D =[-5, -4, -3, -2, -1]
E = [1, -7, 3, - 9, 5]
I did
A=[1:5]
B=[2:3:14]
C=[20:-5:0]
D=[-5:-1]
but for E I couldnt figure it out, any suggestions please.

채택된 답변

Bob Thompson
Bob Thompson 2019년 2월 25일
You can define each element of an array individually if you would like. Defining E should be pretty much exactly as it is listed.
E = [1, -7, 3, - 9, 5]; % For a single row array. Use ';' between elements for a single column array.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by