Answered
How to convert time domain to frequency domain
Replace the following line : subplot(2,1,4);plot(t,z); figure; by the following code nfft = length(y); f = (0:1/nfft:1-1/nf...

6 years ago | 0

| accepted

Answered
Code following function?
Try this: z = zeros(size(y)); z(y>0) = 1; z(y<0) = -1;

6 years ago | 1

| accepted

Answered
how to find the eigen value and plot them?
To find the eigen values you can use : e = eig(A); help eig % for more information on eigen function and how to use it and ...

6 years ago | 0

Answered
Low, High, and Band pass filter
Assuming you can interpolate the data and make altitude to vary at fixed step of 0.02 km and 1km equivalent to 1sec. To make bu...

6 years ago | 1

| accepted

Answered
matrix dimension must agree
In line, tl=(0:L-1).*Ts; Ts is of dimension 1x199 and you are muliplying it with a vector of dimesion 1x1500. Since, you are ...

6 years ago | 0

Answered
Calculate continuous Fourier Series for 50 coefficients
Try this : r = @(x)0; f = @(x) cos(3*x) - 0.5*sin(5*x) + 0.05*cos(54*x); a0 = (1/pi)*integral(f,-pi,pi); a50 = @(x) (1/pi)*i...

6 years ago | 1

| accepted

Answered
Creating Vector using MATLAB
Try Out = mean(X,1); % for row wise mean

6 years ago | 0

| accepted

Answered
How do I fix this code to get a proper moving average plot?
Your basic function 'running_avg' seeems to be working perfectly. However, If you want answers exactly as you would get using mo...

6 years ago | 0

| accepted

Answered
How to find the index in a row vector where a number exceeds a certain value?
Try : A = 1:100; lim = 50; ind = find(A>lim,1); %% Here 1 after comma suggests the first element that is greater than 50 In ...

6 years ago | 0

| accepted

Answered
Labels dont show up
One way to do this : f = @(t,y) t*y-y; y0 = 0.5; t = 0:0.2:1; [t,y1] = euler(f,t,y0); plot(t,y1,'DisplayName','Euler 0....

6 years ago | 0

Answered
Why in the for cycle the values of the first row of the matrix y(i,j) don't exist?
I think FUNCTIONALITY13 is being updated after each i, so FUNCTIONALITY13 is not storing all the values as matrix. You might w...

6 years ago | 1

Answered
Creating a graph of sin(x) and the taylor series for its approximation
Change the line x=linspace(0,100,2*pi); by x=linspace(0,2*pi,100); I hope it helps !

6 years ago | 1

Answered
Surf plot using meshgrid
Try this : snr_data = xlsread('snr values.xlsx'); depth = [1,2,3,5]; level = 1:7; depth_mesh = meshgrid(depth,level).'; lev...

6 years ago | 1

| accepted

Answered
resistors in a circuit
Try this : r3 = 100; % for example Volt_func = @(r)1.24*(r(1)*r(2)+r(2)*r3+r3*r(1))/r(1)/r(2); rout = lsqnonlin(Volt_func,...

6 years ago | 0

| accepted

Answered
How to implement a formula involving several elements of the same vector?
There are several way to do this, but most basic would be to use 'for' loop to get the feeling of how Matrix indexing works: Pe...

6 years ago | 1

| accepted

Answered
how to call multiple access file from one folder in matlab
One of the several ways to do this : clear all, close all, clc PathName = 'C:\Users\.......\0 degree\'; % Set the path where f...

6 years ago | 0

Answered
Index exceeds matrix dimensions.
P2 is an array of dimesion 1x199 and L=1500. So, when you write : P1=P2(1:L./2+1); that means P1 = P2(1:751); So, indeces of...

6 years ago | 0

| accepted

Answered
convert min, hours to 00:00:00 format
Use datestr() to convert number to time x = 15; if x>=60 out = datestr(x/24/60,'HH:MM:SS') else out = datestr(x/24...

6 years ago | 0

Answered
How to solve two differential equations using ode45
Are you sure, e1,e2,c1,c2 are time-variant and not constant ? If they are time-variant then there should be differential terms o...

6 years ago | 0

| accepted

Answered
How do I plot every 10th row of data?
One way to do this efficiently would be to scan the data inside the file at once (instead of doing it one by one in a loop) : ...

6 years ago | 0

| accepted

Answered
how do I insert a custom power curve?
Looks like a "1-D Lookup Table" block in simulink. For more details refer to following link : 1-D Lookup Table

6 years ago | 2

| accepted

Answered
How can I fill an array with varying input dimensions and data type change?
Try this: last_digit_vec = mod(Generator,10); v = {}; for i = 1:length(Generator) v = [v,eval(['mod',num2str(last_digit_...

6 years ago | 1

| accepted

Answered
how to use the row&column indices returned by find to control array element in matrix way
One of the way could be to use absolute indexing of X matrix : ind = find(X==1); ex(ind)=ex(ind)+0.5*(data(ind)-data(ind-je));...

6 years ago | 0

| accepted

Answered
check inside cell condition
Try this: for i = 1:length(AppleDECB) if ~ischar(AppleDECB{i}) % check if cell doesn't contain char continue; ...

6 years ago | 0

| accepted

Answered
Average range when value is reached
I assumed that you have test_data in a mat file, for this answer I am assuming the data stored in the variable named 'TestData'....

6 years ago | 1

Answered
why does sine curve not properly plotted in simulink
I reckon that you are using variable time step so when you increase your time, time step also increases. So, the curve is not as...

6 years ago | 2

| accepted

Answered
Finding Values nearest a certain number
If I understand it clearly your P(and d) is a row/column vector of length 4650 and you need to find 11 points which are closest ...

6 years ago | 0

Answered
How to show the legends of this plot?
You can change the order of plots to assign the legend as required. So, if you want leg1 to show 1st line then you should plot i...

6 years ago | 0

Answered
making a title using editable strings without stacking
In the code you have shown the second to last line as title([get(handles.Title_Input, 'String') get(handles.Y_Label_Input, 'Str...

6 years ago | 0

| accepted

Answered
Comparing arrays and calculating
Try this : for i = 1:length(A2) [Alh,im] = sort(A2); w1 = im(find(Alh>A1,1)); % The index for which the v...

6 years ago | 0

| accepted

Load more