Answered
How to find the indices of same values within a vector and bin them together
See if this works with your data: A=[ 1 2 3 3 3 3 4 5]; B=[ 9 8 7 6 5 6 7 8]; [Au,~,ix] = unique(A(:),'stable');...

8 years ago | 1

Answered
Why is this assignment displaying an error?
You did not terminate the *|‘K’|* matrix with a square bracket. Do this: 0, 0, 0, 0, 0, 0, 0, 0, 0, -k10, k10]; an...

8 years ago | 0

| accepted

Answered
how to organize my histogram please
Try this: edges = linspace(3000, 41000, 40); % Define 39 Bins With 40 Edges histOb...

8 years ago | 0

| accepted

Answered
How do I create and assign custom color scheme per value on a scatter3 plot?
That seems to be described in the documentation for *|scatter3|*: |scatter3(X,Y,Z,S,C)| draws each circle with the color spe...

8 years ago | 0

| accepted

Answered
How can I change the line color in a 2D graph using colormap?
I am not certain what result you want. Try this: A = rand(10,5); cm = colormap(parula(size(A,1))); ...

8 years ago | 5

| accepted

Answered
Problem in ezplot with simple equation
Not all differential equations have analytical solutions. Fortunately, *|ode45|* will integrate this without problems: DE...

8 years ago | 0

| accepted

Answered
I want to find particular values of t at which y becomes 2 (by writing some commands in code itself). Can I extract such values of t as a vector?
Try this: N=2000; % Number of time stpes dt=0.05; %Time step %Initialize y=zeros(N,1); t=zeros(N,1); %Ini...

8 years ago | 0

| accepted

Answered
Looped function with variables that update - possible?
I’m not certain what you’re doing, or what you want. The *|fminsearch|* function iterates internally to calculate the minimum o...

8 years ago | 0

Answered
each diagonal of a matrix
Try this: A = [1 2 3; 4 5 6; 7 8 9]; Af = fliplr(A); % Flip Matrix ND = si...

8 years ago | 2

| accepted

Answered
Why doesn't anything show up on my plot?
Define *|‘D’|* _before_ the loop, and subscript *|‘nf’|* _in_ the loop: Fi=1000; Se= 50; Su= 450; C= 2/3;...

8 years ago | 1

| accepted

Answered
I keep getting Index exceeds array bounds. for my code and don't know why.
You have a system of *|6|* differential equations, and a *|2|*-element initial condition vector. You need to provide *|6|* init...

8 years ago | 1

| accepted

Answered
Exponential precision of power engineering format
For Command Window and ‘tooltip’ formatting, use: format short eng or: format long eng For printed output (usi...

8 years ago | 2

Answered
Using while loop to run through equation n times using column matrix of n rows
I would not use the Symbolic Math Toolbox for iterative numerical calculations. It is inefficient for that purpose. I woul...

8 years ago | 0

| accepted

Answered
Obtain information on a matrix
For the first, use the *|size|* function: [rows, cols] = size(A); For the second, create a vector from the matrix eleme...

8 years ago | 0

Answered
Display parameters in a different window
Try this: a=2; b=1; figure(1) plot((1:10), rand(1,10), 'p') grid ps = {'a' 'b'}; ...

8 years ago | 0

| accepted

Answered
Problem running linear fit y= m*x
Use the <https://www.mathworks.com/help/matlab/ref/mldivide.html *|mldivide,\|*> (link) function: m = x(:)\y(:);

8 years ago | 0

Answered
How ignore heaerlines and import only the data
I would use <https://www.mathworks.com/help/matlab/ref/textscan.html *|textscan|*> (link): fidi = fopen('1_Linear.txt', 'r...

8 years ago | 0

| accepted

Answered
Help with integral2 calculator
Use the <https://www.mathworks.com/help/matlab/ref/str2func.html *|str2func|*> (link) function. I would also use <https://www.m...

8 years ago | 0

| accepted

Answered
Importing large data set in multiple formats including scientific notation
You need to change the format string. I would do something like this: m = textscan(fid,'%f%f%f%s%s','HeaderLines',2,...

8 years ago | 1

| accepted

Answered
Spectrogram time axis samples to actual time
Include the sampling frequency, and the result is a time-frequency plot (rather than an index-frequency plot). See for example:...

8 years ago | 0

| accepted

Answered
How can I find coefficients for a sinusoidal function?
An oldie but a goodie: <http://www.mathworks.com/matlabcentral/answers/121579-curve-fitting-to-a-sinusoidal-function *Curve fitt...

8 years ago | 0

Answered
How can I remove the subplot colorbar label overlaps?
The easiest option is to use the <https://www.mathworks.com/help/matlab/ref/colorbar.html?s_tid=doc_ta#bt5djl2-1_sep_shared-Font...

8 years ago | 0

| accepted

Answered
How to solve 'Error using symengine. Invalid input. 'expression' is expected.'?
Delete the single quotes, and add a ‘double equal’: Tz=solve(Tz == (((xiz*(QH-deltaQH))./(M1.*(1+gammar)))+mcphayvc.*Tc)./...

8 years ago | 1

| accepted

Answered
Abscissa of a vertical line
The abscissa is the *|x|*-value, so it is whatever value of *|x|* you have plotted it on. (That is my understanding, and <https...

8 years ago | 0

Answered
how to plot a function handle on matlab 7 ?
You need to evaluate the function in the *|plot|* call. *_Example_ —* fun = @(x) x.^3 - 8*x.^2 + 10; x = linspace(...

8 years ago | 2

| accepted

Answered
NONLINEAR EQUATIONS WITH FSOLVE
I have no idea what your function is. You can do something like this: T = linspace(270, 300, 10); ...

8 years ago | 1

| accepted

Answered
Frequency spectrum after every 2 seconds.
See the documentation on the Signal Processing Toolbox <https://www.mathworks.com/help/signal/ref/spectrogram.html *|spectrogram...

8 years ago | 0

Answered
How can i get variables from GA ?
You may have to write your own function if the available *|'OutputFcn'|* options do not do what you want. See the documentation...

8 years ago | 0

Answered
Fminsearch for fitting models?
When in doubt, simulate: p = [2 5]; X = 0:20; Yfcn = @(p,X) 1./(1+exp(-p(1).*(X-p(2)))); Y = Yfcn(p,X) + 0.1*rand...

8 years ago | 0

| accepted

Answered
Create a logical array based on signal thresholds
If I understand correctly what you are doing, *_and if_ |‘FxRMS’| _is a vector_*, you can completely eliminate the loop and do y...

8 years ago | 0

| accepted

Load more