Answered
How to better utilize 'input'?
I prefer the <https://www.mathworks.com/help/matlab/ref/inputdlg.html *|inputdlg|*> (link) function. It saves the input values ...

8 years ago | 0

| accepted

Answered
Output argument "Mu" (and maybe others) not assigned during call to "Mu".
One way to solve the problem of *|‘Mu’|* not being assigned is to assign it a default value, usually *|NaN|*, that will then be ...

8 years ago | 0

Answered
How do I save a cell array as txt file?
One approach is just to use *|fprintf|*: AC = {'abd', 'defg', 'hijklm', 'nop'}; fid = 1; fprintf(fid, '%s\n', AC{:})...

8 years ago | 0

Answered
How can I generate audio chirp signal ?
Try this: t = linspace(0, 4.8, 4.8E+4); f0 = 200; f1 = 10000; Fs = 1/mean(diff(t)); x = chirp(t,f0,t(end),f1...

8 years ago | 0

Answered
Dimensions of matrices being concatenated are not consistent. error while building 118 by 118 matrix
We need to see your code. The placement of spaces, operators, and other delimiters are important in MATLAB matrices and vec...

8 years ago | 0

Answered
why the square wave is just a line?
You can only do paired comparisons. Break the logic up into two separate conditions and it works: s(-2.75 <= t & t < -0.2...

8 years ago | 0

| accepted

Answered
why i'm getting this error?
Your *|‘an’|* and *|‘bn’|* are *|(1x4)|* vectors, and *|‘t’|* is *|(1x500)|*. One way to avoid it is to transpose *|‘an’|* ...

8 years ago | 0

| accepted

Answered
Row insertion and interpolation
Try this: data = [0 135 140 500; 0.03 139 120 485; 0.06 133 127 489; 0.09 131 122 450; 0.15 160 149 503]; ti = min(...

8 years ago | 0

| accepted

Answered
install from downloaded files
I have no idea what you are doing or the problems you are having. *_NOTE_:* This applies to Windows. I had to do this ...

8 years ago | 0

Answered
Plot inverse of ECG signal
That could be normal, depending on the lead, for example in *|aV_R|* or *|V_1|*. If you want to invert it, the easiest way ...

8 years ago | 0

| accepted

Answered
Create a function from a table
Try this: A = [ 1 0.1; 2 0.2; 3 0.3]; A2fcn1 = @(k) A(k,2); SecondColumn = A2fcn1(2) SecondColumn = ...

8 years ago | 1

| accepted

Answered
Replace for loop values saved as a vector using a condition
Use ‘logical indexing’: r = [1 9 0 0 1 2 5 16]; r(r==0) = NaN r = 1 9 NaN NaN 1 2 5 ...

8 years ago | 1

| accepted

Answered
How to turn a multivariable function to multidimensional x-function?
The <https://www.mathworks.com/help/matlab/ref/varargin.html *|varargin|*> (link) function is an option: f = @(varargi...

8 years ago | 0

Answered
How to read different csv files?
The <https://www.mathworks.com/help/matlab/ref/readtable.html *|readtable|*> (link) function would be my preference. It is very...

8 years ago | 1

| accepted

Answered
How to change y axis label with percentage?
I am not certain what result you want. Try this: x = [1,2,3,4,5,6,7,8]; y = [2.8, 3.33, 4.8,2.1,2.5,0.35,3.4,1.6];...

8 years ago | 3

Answered
Elementwise Multiplication (Dot Multiplication) of Matrices
It’s called ‘implicit expansion’, and was introduced in *|R2016b|*. I can’t find a specific link to it. You can find it un...

8 years ago | 1

| accepted

Answered
Please help me how to deal with this. i double check this but the same error occurred "Error using vertcat Dimensions of matrices being concatenated are not consistent."
The *|‘C8’|* vector has *|9|* columns because *|‘0-k4’|* is assumed to be a single element. Spaces (and other delimiters) are i...

8 years ago | 0

| accepted

Answered
I want this to run 3 times with values of p =5 10 and 20 and graph each of them in subplot instead of having p=input
Try this: t=linspace(-2,2,101); xa=zeros(1,size(t,2)); xp=zeros(1,size(t,2)); figure(2) p = [5 10 20]; for ...

8 years ago | 0

| accepted

Answered
Problem with linear least squares, '\' does not work, Why ?
The key to understanding what the *|mldivide,\|* function is doing here is *_‘least-squares solution’_*. You have an overde...

8 years ago | 2

| accepted

Answered
Change yticks to years in 3D plot surf
In *|R2017b|* and later, you can use the <https://www.mathworks.com/help/matlab/ref/datetick.html *|datetick|*> (link) function ...

8 years ago | 0

Answered
Pass a parameter to vector of variables for fmincon
Probably the easiest way is to set *|‘x0’|* appropriately and then bound *|‘x(2)’|* to be *|40|*: x0 = [20 40 20]; lb =...

8 years ago | 0

| accepted

Answered
how to convert grayscale image to binary matrix?
See the documentation on the <https://www.mathworks.com/help/images/ref/im2bw.html *|im2bw|*> (link) and <https://www.mathworks....

8 years ago | 0

Answered
Rotating a cylinder by 90 degrees
I don’t understand what your problem with *|rotate|* is. Try these: [x,y,z]=cylinder([0,10,10,0],100); z([1,2]...

8 years ago | 1

| accepted

Answered
I can't seem to get L to plot
Use *|fplot|* to plot it instead: fplot(L, [0 30]) That works.

8 years ago | 0

Answered
fminsearch Usage Question for function with 3 inputs
See if the solution in <http://www.mathworks.com/matlabcentral/answers/121579-curve-fitting-to-a-sinusoidal-function *Curve fitt...

8 years ago | 0

Answered
fsolve to get steady state concentrations versus reactor height
The *|fsolve|* function is a root-finding routine. It will return the values of *|‘C’|* that solve your equations for zero. Yo...

8 years ago | 0

| accepted

Answered
[Beginner] How to plot the resonance frequency with bandwidth
Try this: f = linspace(0, 10); % Create Data: Frequency h = exp(-(f-5).^2); ...

8 years ago | 1

| accepted

Answered
Writing this Mathcad equation in Matlab
Try this: psi = 0.142; Io = 1; f_vir2 = @(r) 4*Io * abs(integral(@(rho)besselj(0, pi*rho*r*psi).*rho, 0, 1)).^2; ...

8 years ago | 0

| accepted

Answered
simultaneouslty fIt ode soln to multiple datasets with lsqcurvefit
Your function appears to be essentially correct. The *|lsqcurvefit|* function _can_ fit matrix dependent variables. Howeve...

8 years ago | 0

| accepted

Load more