Answered
How do I get a simple fraction in MATLAB?
Use the *|vpa|* function to get decimal fractions.

9 years ago | 1

Answered
Need help trying to plot power beam patterns in dB
My pleasure. The reason your plot is not working out as you want it is that you are using *|semilogy|* to plot a signal you...

9 years ago | 0

| accepted

Answered
Hello, why is p different for these two calls to polyfit? Case 1: [p,S] = polyfit(x,y,1). Case 2: [p,S,mu] = polyfit(x,y,1).
Asking for the *|‘mu’|* output tells *|polyfit|* to do centring and scaling on your *|(x,y)|* arguments _before_ estimating the ...

9 years ago | 0

Answered
error using ode23
You have not passed *|‘T’|* and *|‘d’|* to *|‘boost’|* as extra parameters, nor have you defined them in the function. Since *|...

9 years ago | 0

Answered
Bar graph comparison with custom x-axis and text
This will work for your two-variable problem: y1=[[0.41 0.38 0.42]]; y2=[[0.63 0.75 0.81]]; x=1:3; figure(1) b...

9 years ago | 1

| accepted

Answered
How to find phase shift and do phase shift correction between two signals in frequency domain?
I had to look up <https://en.wikipedia.org/wiki/Terahertz_time-domain_spectroscopy *Terahertz time-domain spectroscopy*>. Y...

9 years ago | 3

| accepted

Answered
fprintf('iteration %d, value %f\n', [k, fun_val]) printing out wrong value
Your *|‘fun_val’|* variable is a *|(1x2)|* vector. Choose _one_ element of it (or the mean of them or something else), then pri...

9 years ago | 0

Answered
Quiver vector length difficulty
Specifying *|0.5|* as the scale factor simply halves their lengths. it does not remove scaling. If you want them not scaled, u...

9 years ago | 0

Answered
Discrete time survival function
There are several discussions of survival analysis in the Statistics and Machine learning Toolbox documentation. See for exampl...

9 years ago | 1

Answered
Why does my for loop generate the inproper matrix. It spits out way more zeros then there should be
MATLAB assigns vectors so that each element is filled, so in your code, *|‘T’|* will have *|90001|* elements, even though on *|4...

9 years ago | 0

Answered
I need to calculate the integration
See if this does what you want: syms t h1(t)=t-1; % if [0,1] h2(t)=t^2+2; % if [1,2] h3(t)=t^2+3; % i...

9 years ago | 0

| accepted

Answered
sind(180) Index exceeds matrix dimensions.
You may have a scalar variable named *|‘sind’|*. Run this line in your Command Window (or a script): which sind -all I...

9 years ago | 0

Answered
How can i use the curve Goodness of Fit ?
If you are referring to the System Identification Toolbox <https://www.mathworks.com/help/ident/ref/goodnessoffit.html *|goodnes...

9 years ago | 0

| accepted

Answered
finding the max values
See if this does what you want: k = 4; arr = [ 1 9 4 7 38 8]; Result = arr(arr > k) Result = 9 ...

9 years ago | 0

Answered
How to compare values in two vectors and modify a new vector based on that results?
Try this anonymous function: va = @(t1,t2,Az1,Az2) (t1 >= t2).*Az1 + (t1 < t2).*Az2; Az1 = 10; Az2 = 20; ...

9 years ago | 1

Answered
How to solve complex equation
Use *|fzero|*, a loop, and *|uniquetol|*: f = @(x) x^2 - 100*x + 120 - 400*sin(x); for k1 = 1:100 s(k1) = fz...

9 years ago | 0

Answered
Why is an empty string not empty? isempty('') returns true, but isempty("") returns false
Another option is the <https://www.mathworks.com/help/matlab/ref/strlength.html *|strlength|*> (link) function. It appears to g...

9 years ago | 3

Answered
For loop ranging from negative to positive integers?
MATLAB indices must be integers greater than zero (or logical values). Create your current *|‘i’|* vector to *|‘iv’|* (for ...

9 years ago | 0

Answered
How to solve for each value a SOLVE equation
I would not use the Symbolic Math Toolbox for this, and use the Optimization Toolbox *|fsolve|* function or the core MATLAB func...

9 years ago | 0

| accepted

Answered
Could anyone help me to solve the following error
That line looks correct to me. Look at the line just *_above_* it. That is probably where the error actually is.

9 years ago | 0

Answered
Could anyone help me to solve with the following issue.
Probably the easiest way is to create *|‘G’|* as a cell array: G{t,r} = rand(A(t),B(r)); Then you can address each elem...

9 years ago | 0

| accepted

Answered
get the intersection points in the graph
Try this: x = [1,2,3,4,6,7,9,12,14,15,17,18,19]; y = [0,2,4,5,7,9,10,8.5,6,4,2,1.5,0]; yline = 1; zci = @...

9 years ago | 1

| accepted

Answered
fit gaussian to a known sigma
Try this: gaussfcn = @(b,x) b(1).*exp(-((x)./b(2)).^2); xv = linspace(-10, 10); b = [1; 4.2]; yv = gaussf...

9 years ago | 0

| accepted

Answered
How can i filter a EEG signal ?
See for example: <http://www.mathworks.com/matlabcentral/answers/311687-hi-all-i-m-having-trouble-to-get-transfer-function-for-t...

9 years ago | 0

| accepted

Answered
Plot multivariable function, find critical points
Use the *|gradient|* function to calculate the derivative. Try this: [x1,x2] = meshgrid(-5:.2:5); ...

9 years ago | 0

| accepted

Answered
How to shade area between an upper bound and lower bound curve?
It would help to have at least a sample of your data. Without it, a _guess_ is the best I can do. With the monotonically-i...

9 years ago | 1

| accepted

Answered
How to reference values in cell array containing matrices
Use *|cellfun|*. This seems to work: % Create the cell array for iMatrix = 1:10 DisplayMatrix = rand(12, 13...

9 years ago | 0

| accepted

Answered
How graph second order differential equation with Matlab?
Do them the same as you did before. Define *|‘Dy’|* and *|‘D2y’|*, then substitute them for *|y'|* and *|y"|* respectively. Us...

9 years ago | 0

Answered
How do I get the maximum of repetitive elements in certain portions of a matrix?
The only way I can see to do this is with a loop that selects and analyses each *|10|*-row segment. This works: A = [...

9 years ago | 1

| accepted

Answered
Anonymous Function with natural log inside
Your functions are actually all functions of *|‘h’|*. To refer to *|‘p’|* in *|‘T’|*, you need to refer to it as *|‘p(h)’|*. ...

9 years ago | 2

| accepted

Load more