Solved

Fibonacci sequence

Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: Inpu...

2 months ago

Answered

How to change time intervals to time elapsed

You can do this simply using a loop a=[1 2 1 1 3] sum=0; result=zeros(1,length(a)); for i=1:length(a) sum=sum+a(i); ...

How to change time intervals to time elapsed

You can do this simply using a loop a=[1 2 1 1 3] sum=0; result=zeros(1,length(a)); for i=1:length(a) sum=sum+a(i); ...

2 months ago | 0

| accepted

Answered

Plotting multiple points on a graph using for loop

Final version clc clear all close all fn= @(xi,omega,t) (1-((exp(-xi*omega*t))/sqrt(1-xi^2)).*sin(omega*sqrt(1-xi^2)*t+acos(...

Plotting multiple points on a graph using for loop

Final version clc clear all close all fn= @(xi,omega,t) (1-((exp(-xi*omega*t))/sqrt(1-xi^2)).*sin(omega*sqrt(1-xi^2)*t+acos(...

2 months ago | 0

| accepted

Answered

How to create a function as sum of some sine functions?

This can be done like y=0; %necessary to add the other things for i=1:length(a) y=y+a(i).*sind(2*pi*f(i).*t+theta(i)); e...

How to create a function as sum of some sine functions?

This can be done like y=0; %necessary to add the other things for i=1:length(a) y=y+a(i).*sind(2*pi*f(i).*t+theta(i)); e...

3 months ago | 1

Answered

How can I use a loop to input different arrays into the same equation so I do not have to repeat code?

You can make A as a vector A=[[1 2 3 4];[5 6 7 8];[9 10 11 12]]; A=A*3; To use A or B or C we can use A(1,:) %To use as A A...

How can I use a loop to input different arrays into the same equation so I do not have to repeat code?

You can make A as a vector A=[[1 2 3 4];[5 6 7 8];[9 10 11 12]]; A=A*3; To use A or B or C we can use A(1,:) %To use as A A...

4 months ago | 0

Answered

How can I use a loop to input different arrays into the same equation so I do not have to repeat code?

Don't know why you want to use a loop for that . for i=1:3 Arr[i,:]=Arr[i,:]*3; %That's only useful if you have a vector. ...

How can I use a loop to input different arrays into the same equation so I do not have to repeat code?

Don't know why you want to use a loop for that . for i=1:3 Arr[i,:]=Arr[i,:]*3; %That's only useful if you have a vector. ...

4 months ago | 0

Answered

Delete rows from an array

Your code will work like this if used on 1 D array . CEC((2+6):end) = [0]; If you are using that your array shall be 52560X525...

Delete rows from an array

Your code will work like this if used on 1 D array . CEC((2+6):end) = [0]; If you are using that your array shall be 52560X525...

4 months ago | 0

Answered

2 Variable increment in one "for Loop'

Or use j= 2*i for i=1:9 %the end term will also come so use 9 here. j=2*i; %function end

2 Variable increment in one "for Loop'

Or use j= 2*i for i=1:9 %the end term will also come so use 9 here. j=2*i; %function end

4 months ago | 0

Answered

Remove duplicates only for specific values

After using that array of elements to value_to_remove . A = [1,2,2,3,3,4,5,5,5,6]; value_to_remove = [2,3]; is_repeting=zeros...

Remove duplicates only for specific values

After using that array of elements to value_to_remove . A = [1,2,2,3,3,4,5,5,5,6]; value_to_remove = [2,3]; is_repeting=zeros...

4 months ago | 0

Answered

Function Matlab graph help

This shall be done in a script or even in command window. x=-2:0.1:2 ; %makes an array for x with values -2 to 2 with increment...

Function Matlab graph help

This shall be done in a script or even in command window. x=-2:0.1:2 ; %makes an array for x with values -2 to 2 with increment...

4 months ago | 0

| accepted

Answered

Is there any command by which we can plot the constellation points with arrows in between??

Maybe try the grid on command it will generate a graph sheet so easier to compare distances. scatterplot(qam_modulated_data) g...

Is there any command by which we can plot the constellation points with arrows in between??

Maybe try the grid on command it will generate a graph sheet so easier to compare distances. scatterplot(qam_modulated_data) g...

4 months ago | 0

| accepted

Answered

Index exceeds the number of array elements (1).

I run it with adding 1 more dot before division . this runs and plots the graph though I am not sure if everything is working fi...

Index exceeds the number of array elements (1).

I run it with adding 1 more dot before division . this runs and plots the graph though I am not sure if everything is working fi...

4 months ago | 0

| accepted

Answered

Index exceeds the number of array elements (1).

What I guessed it you didn't use the loop properly clear all; Rj=(1:1:30); Pj= 1; %Power in Watts Gj= 1; %Gain of antenna of...

Index exceeds the number of array elements (1).

What I guessed it you didn't use the loop properly clear all; Rj=(1:1:30); Pj= 1; %Power in Watts Gj= 1; %Gain of antenna of...

4 months ago | 0

Answered

Plot a rectangular Pulse from -1 to 1

% the syntax for taking input t eg:[-2 -1 1 2] =>t1=[-2,-1 ], t2=[-1 1], t3=[1 2]. %I was sleepy earlier so didn't run the co...

Plot a rectangular Pulse from -1 to 1

% the syntax for taking input t eg:[-2 -1 1 2] =>t1=[-2,-1 ], t2=[-1 1], t3=[1 2]. %I was sleepy earlier so didn't run the co...

4 months ago | 0

Answered

Change the data from table format to double format

%Just import the table in matlab and it shall come as double . %Later you can select the required columns using trainingdata(:...

Change the data from table format to double format

%Just import the table in matlab and it shall come as double . %Later you can select the required columns using trainingdata(:...

4 months ago | 0