답변 있음
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...

6년 초과 전 | 0

답변 있음
Extracting user defined data
You can use readmatrix to get the data out of the spreadsheet. You can use interp2 to do the interpolation.

6년 초과 전 | 0

답변 있음
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...

6년 초과 전 | 1

| 수락됨

답변 있음
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 . ...

6년 초과 전 | 1

답변 있음
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...

6년 초과 전 | 0

| 수락됨

답변 있음
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 =...

6년 초과 전 | 0

| 수락됨

답변 있음
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...

6년 초과 전 | 1

| 수락됨

답변 있음
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 ...

6년 초과 전 | 1

답변 있음
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....

6년 초과 전 | 0

답변 있음
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...

6년 초과 전 | 0

답변 있음
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...

6년 초과 전 | 0

| 수락됨

답변 있음
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(...

6년 초과 전 | 0

| 수락됨

답변 있음
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 ...

6년 초과 전 | 0

| 수락됨

답변 있음
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...

6년 초과 전 | 1

답변 있음
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...

6년 초과 전 | 0

| 수락됨

답변 있음
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...

6년 초과 전 | 0

| 수락됨

답변 있음
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...

6년 초과 전 | 0

| 수락됨

답변 있음
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 ...

6년 초과 전 | 2

| 수락됨

답변 있음
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...

6년 초과 전 | 0

| 수락됨

답변 있음
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 = ...

6년 초과 전 | 1

답변 있음
Interpolation values from a table
If T.area is a cell array, and maybe T.Mach is also a cell array you must first turn them into ordinary MATLAB vectors, (n by...

6년 초과 전 | 1

답변 있음
Having trouble getting legend to display properly
You could also try putting a common legend on the bottom of the page. Here is an example of how to do that x = 1:100; y = rand...

6년 초과 전 | 0

답변 있음
connection Ports of subsystem
It looks like you are using Simscape. I don't have it, so I can't try, but I think you need to convert from a Simulink signal to...

6년 초과 전 | 0

답변 있음
How to fit a general curve on different datasets ?
If I am understanding what you are trying to do correctly, it seems like you should be able to concatenate all of your individua...

6년 초과 전 | 0

답변 있음
matrix with vectors: multiplication and generation issue
Yes you could do this with a loop, for example, with just some arbitrary set values for i, a, b, c, d, e, g to illustrate theta...

6년 초과 전 | 1

| 수락됨

답변 있음
How to Create the following discrete signal (Y[n]) in MATLAB?
You could do something like this x = [-1 0 1 2 3 4 4 4 4 4] n = 1:length(x) y = NaN(1,n(end)) % preallocate providing NaN (No...

6년 초과 전 | 0

답변 있음
add new rows to a Matrix
Just as another possibility, this approach is much less general than @Jos but will work for your special case. I didn't look in...

6년 초과 전 | 0

답변 있음
How do I get my code to run multiple times? My code looks as follows. My code shows X = 3 when A wins and X = -3 when B wins. I would like to get this code to run multiple times and see how many times A wins out of 10 or so matches.
You don't need a loop for this, just do something like the following N = 10 % number of trials X = rand(N,1) Awins = sum(X<0....

6년 초과 전 | 0

| 수락됨

답변 있음
How to divide data into different cells?
Your looping logic looks quite complicated, and it is difficult to follow exactly what your intent is here. From your verbal des...

6년 초과 전 | 0

| 수락됨

답변 있음
Faster Alternative to export_fig
Improving somewhat on my earlier comment you could do something like this % provide matrix dimension m = 900; n = 1600; ...

6년 초과 전 | 0

| 수락됨

더 보기