# Array computation in Matlab

3 views (last 30 days)
Telema Harry on 10 Feb 2021
Commented: KSSV on 10 Feb 2021
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.

KSSV on 10 Feb 2021
Check the below example:
theta = [0 30 45 60 90 180] ; % angle in degrees
y = sind(theta)
##### 2 CommentsShowHide 1 older comment
KSSV on 10 Feb 2021
What is there? According to your equation always n(1)..n(11) is zero.

R2020a

### Community Treasure Hunt

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

Start Hunting!