필터 지우기
필터 지우기

Array computation in Matlab

조회 수: 2 (최근 30일)
Telema Harry
Telema Harry 2021년 2월 10일
댓글: KSSV 2021년 2월 10일
Please i need help in writing this code. My other option is to write the code manually. But I figured that would not be efficient. as it will involve several variables.
N is a 1 X 11 row vector
N(1) = 10, N(2) = 10, N(3) = 100, ....... N(11) = 100000
n(1) = 0:1: N(1)-1;
n(2) = 0:1:N(2) - 1; .... n(11) = 0:1:N(11) - 1;
Then I want to use this variables for my computation. For example
X(1) = cos (2*pi*n(1)./N(1)),
all the way to
X(11) = cos (2*pi*n(11)./N(11)),
I have not figured how to create an array for this operation, since n have different.
My goal is to comput values of X at the different values and compare the computational time.

답변 (1개)

KSSV
KSSV 2021년 2월 10일
Check the below example:
theta = [0 30 45 60 90 180] ; % angle in degrees
y = sind(theta)
  댓글 수: 2
Telema Harry
Telema Harry 2021년 2월 10일
Thank you for the feedback. However, My problem is different. My case is stated below.
n(1) = 0:1:30, n(2) = 0:1:45, n(3) = 0:1:60.
y(1) = sind(theta(1)*n(1))
y(2) = sind (theta(2)*n(2))...........
KSSV
KSSV 2021년 2월 10일
What is there? According to your equation always n(1)..n(11) is zero.
Read about linspace, meshgrid.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by