Answered

How to replace complex numbers in a column vector with 0.000+0.000i ?

Suppose you have a complex vector (the result of your fft) lets call it x. If you want to replace some elements of it with zero ...

How to replace complex numbers in a column vector with 0.000+0.000i ?

Suppose you have a complex vector (the result of your fft) lets call it x. If you want to replace some elements of it with zero ...

19 hours ago | 1

Answered

how can i answer how to plot signal, and its frequency and phase. Then add a noise signal and plot the same parameters?

Here are some ideas to get you started If you just want to visualize V1 as a function of time you can assign a vector of values...

how can i answer how to plot signal, and its frequency and phase. Then add a noise signal and plot the same parameters?

Here are some ideas to get you started If you just want to visualize V1 as a function of time you can assign a vector of values...

4 days ago | 0

| accepted

Answered

Plot over time milliseconds

I'm not quite clear on what you are trying to accomplish but it looks like some how you want to see the plot continue to evolve ...

Plot over time milliseconds

I'm not quite clear on what you are trying to accomplish but it looks like some how you want to see the plot continue to evolve ...

7 days ago | 1

| accepted

Answered

How to save MPC (model predictive controller) to be used later on? The error message is attached.

A way around this problem is to: 1) Design your controller 2) Export your controller to the workspace 3) Save your controlle...

How to save MPC (model predictive controller) to be used later on? The error message is attached.

A way around this problem is to: 1) Design your controller 2) Export your controller to the workspace 3) Save your controlle...

8 days ago | 0

Answered

How to save the previous figure generated by function'step(H,x)'

You need to create a new figure just before calling step clear all vars clc fs = (5/2)*1e6; % Symbol rate (Hz) fc=...

How to save the previous figure generated by function'step(H,x)'

You need to create a new figure just before calling step clear all vars clc fs = (5/2)*1e6; % Symbol rate (Hz) fc=...

9 days ago | 0

Answered

Problem with writing this function

You may have some other issues also, but assuming that you have defined x as a column or row vector and you are expecting to cal...

Problem with writing this function

You may have some other issues also, but assuming that you have defined x as a column or row vector and you are expecting to cal...

9 days ago | 1

| accepted

Answered

Find a column number referring to an array

You could use idx = find(V==point(1)) or you could check the column the second element of point matched the second row of A us...

Find a column number referring to an array

You could use idx = find(V==point(1)) or you could check the column the second element of point matched the second row of A us...

9 days ago | 0

| accepted

Answered

Adding characters to a matrix

I think your problem may just be that you need to put single quotes around the g in the function call so use [varAlongDiag, var...

Adding characters to a matrix

I think your problem may just be that you need to put single quotes around the g in the function call so use [varAlongDiag, var...

10 days ago | 0

| accepted

Answered

Storing data in Table inside for loop

Looking quickly at your loop structure, it seems that if you want a row for every iteration you must count how many times you ha...

Storing data in Table inside for loop

Looking quickly at your loop structure, it seems that if you want a row for every iteration you must count how many times you ha...

10 days ago | 0

| accepted

Answered

Extracting user defined data

If you type doc readmatrix on the command line you will get all the documentation, including examples for using this function. Y...

Extracting user defined data

If you type doc readmatrix on the command line you will get all the documentation, including examples for using this function. Y...

11 days ago | 0

| accepted

Answered

Any method to soften harsh edges of a plot?

If you have reason to believe that the data does not really pass through those points (that they are just noise) then MATLAB off...

Any method to soften harsh edges of a plot?

If you have reason to believe that the data does not really pass through those points (that they are just noise) then MATLAB off...

11 days ago | 0

Answered

Extracting user defined data

You can use readmatrix to get the data out of the spreadsheet. You can use interp2 to do the interpolation.

Extracting user defined data

You can use readmatrix to get the data out of the spreadsheet. You can use interp2 to do the interpolation.

11 days ago | 0

Answered

Unusual arrangement of plot

I assume when you say "Red line is plotted by matlab but it is unusal and expected to be blue line" you mean that you expect t...

Unusual arrangement of plot

I assume when you say "Red line is plotted by matlab but it is unusal and expected to be blue line" you mean that you expect t...

11 days ago | 0

| accepted

Answered

Transformation of the Matrix in a Loop

Sorry, I inadvertently deleted my earlier response. So I'm assuming you want an array with y1 x1 z11 y2 x2 z21 y3 x3 z31 . ...

Transformation of the Matrix in a Loop

Sorry, I inadvertently deleted my earlier response. So I'm assuming you want an array with y1 x1 z11 y2 x2 z21 y3 x3 z31 . ...

11 days ago | 1

Answered

How to reset a MultiDimensional Array to allow a fresh building of the MDA

There may be some cleaner way to do this, but I would suggest that one approach would be to use an if statement to test if MDA i...

How to reset a MultiDimensional Array to allow a fresh building of the MDA

There may be some cleaner way to do this, but I would suggest that one approach would be to use an if statement to test if MDA i...

14 days ago | 0

| accepted

Answered

ode45 unexpected behaviour for initial conditions = 0

I think you have a basic conceptual error in your ode definition. You should have an overall state vector x = [x1;x2] whre x1 =...

ode45 unexpected behaviour for initial conditions = 0

I think you have a basic conceptual error in your ode definition. You should have an overall state vector x = [x1;x2] whre x1 =...

14 days ago | 0

| accepted

Answered

How to set lower and upper bound for only one of the output variable in lsqnonlin?

I can't follow all of the details of what you presented but regarding your initial question: How can we write this in case we w...

How to set lower and upper bound for only one of the output variable in lsqnonlin?

I can't follow all of the details of what you presented but regarding your initial question: How can we write this in case we w...

14 days ago | 1

| accepted

Answered

matrix with vectors: multiplication and generation issue

Z is a collection of 2d arrays, where the first index selects a particular 2d array. The tricky thing is that MATLAB considers ...

matrix with vectors: multiplication and generation issue

Z is a collection of 2d arrays, where the first index selects a particular 2d array. The tricky thing is that MATLAB considers ...

15 days ago | 1

Answered

Plotting 4-D arrays in 2-D graph

The axis command and title command are not part of the plot command but you continued them on the same line without a separator....

Plotting 4-D arrays in 2-D graph

The axis command and title command are not part of the plot command but you continued them on the same line without a separator....

17 days ago | 0

Answered

Read text file - ignoring lines starting with specific character.

I'm not sure why you would want to read in numerical data as strings. You can read in the data in your files using (assuming fo...

Read text file - ignoring lines starting with specific character.

I'm not sure why you would want to read in numerical data as strings. You can read in the data in your files using (assuming fo...

17 days ago | 0

Answered

Generate one plot containing the monthly log return time series?

I assume your data with the log return values, or the values you will calculate them from, is in some sort of file, for example...

Generate one plot containing the monthly log return time series?

I assume your data with the log return values, or the values you will calculate them from, is in some sort of file, for example...

18 days ago | 0

| accepted

Answered

Converting equation to matlab

% note .* to get element by element multiplication % ./ for element by element division g = 1.0/(2*pi^2*h^3)*(2*m)^(3/2)*sqrt(...

Converting equation to matlab

% note .* to get element by element multiplication % ./ for element by element division g = 1.0/(2*pi^2*h^3)*(2*m)^(3/2)*sqrt(...

21 days ago | 0

| accepted

Answered

Attempting to combine row vectors

If my understanding of what you are trying to do is correct you can do this as: Ch = [ChD(1:99) ChS(100:350) ChD(351:800)] So ...

Attempting to combine row vectors

If my understanding of what you are trying to do is correct you can do this as: Ch = [ChD(1:99) ChS(100:350) ChD(351:800)] So ...

21 days ago | 0

| accepted

Answered

Rearrange elements in an array based on another array

While I was working on this I see that @Andrei has already posted a very nice vectorized solution. In case it is helpful, here i...

Rearrange elements in an array based on another array

While I was working on this I see that @Andrei has already posted a very nice vectorized solution. In case it is helpful, here i...

23 days ago | 1

Answered

How can I plot these values (result vs. time)?

Your call to plot would just use the last value of n from the for loop as the x variable. Instead use something like period = 2...

How can I plot these values (result vs. time)?

Your call to plot would just use the last value of n from the for loop as the x variable. Instead use something like period = 2...

24 days ago | 0

| accepted

Answered

iterate over single array dimension

You can do it with arrayfun for example coef = randn(12,3) qroots = cell2mat(arrayfun(@(n) roots(coef(n,:)),1:size(coef,1),'Un...

iterate over single array dimension

You can do it with arrayfun for example coef = randn(12,3) qroots = cell2mat(arrayfun(@(n) roots(coef(n,:)),1:size(coef,1),'Un...

25 days ago | 0

| accepted

Answered

more efficient code while using xlswrite and xlsread

Can you use just one call as follows xlswrite(excelfile2,T(:,1:3),j,'O17:Q25') or assuming that that T has only 3 columns xls...

more efficient code while using xlswrite and xlsread

Can you use just one call as follows xlswrite(excelfile2,T(:,1:3),j,'O17:Q25') or assuming that that T has only 3 columns xls...

25 days ago | 0

| accepted

Answered

How to save all my matlab plots from for loop?

I would recommend using the standard MATLAB function saveas (type doc saveas on the command line for help) Specifically inside ...

How to save all my matlab plots from for loop?

I would recommend using the standard MATLAB function saveas (type doc saveas on the command line for help) Specifically inside ...

25 days ago | 1

| accepted

Answered

How to make from different size matrices one size matrices by adding NaN's?

You could do something like this: X = {rand(6,12,4),rand(5,12,4),rand(6,12,4),rand(8,12,4)}; % generate example data for k = 1...

How to make from different size matrices one size matrices by adding NaN's?

You could do something like this: X = {rand(6,12,4),rand(5,12,4),rand(6,12,4),rand(8,12,4)}; % generate example data for k = 1...

1 month ago | 0

| accepted

Answered

im new to matlab, does any one know , how to iterate 8 times ?

You could do this with a for loop, something like this h=[.482962913145,.836516303738,.224143868041,-1.2940952251]; numIter = ...

im new to matlab, does any one know , how to iterate 8 times ?

You could do this with a for loop, something like this h=[.482962913145,.836516303738,.224143868041,-1.2940952251]; numIter = ...

1 month ago | 1