Answered
Minimizing a multivariable function
Your code works for me as you posted it. (I added an *|end|* as the last line of the function, because I have a test function I...

8 years ago | 0

Answered
how i plot 2 equations at different period in one graph?
Try this: x = @(t) (sqrt(2)*1.414*exp(-t).*sin(t+0.785)).*((0 < t) & (t < pi)) + (sqrt(2)*exp(-t).*sin(t+0.785)-exp(-t+pi)...

8 years ago | 0

| accepted

Answered
Using fminsearch to find least distance between 12 points
I can’t run your code since I don’t have your constants. Try this instead: x0=rand(2,1); Using *|0|* as an initial...

8 years ago | 0

Answered
Plotting two linear equations
Use ‘logical indexing’: x = linspace(-5,2); f = @(x) (-1).*(x < -1) + (x.^2 + x).*((x >= -1) & (x < 2)); figure(...

8 years ago | 0

| accepted

Answered
How to eliminate Nan
One option: x=[0.162071097716028 0 0.276531475376737 0 0.264268578570244 0.247172330667782 0.0276055958119857 0.0223509218...

8 years ago | 0

Answered
How to take RMS of every 10 values in a matrix and output this?
Try this: A = randi(9, 66000, 4); % Create Matrix Ar = reshape(A, [], 4, 10); ...

8 years ago | 0

| accepted

Answered
Hey guys. I am trying to solve the equation of motion for a 2D 2-point-vortex. Im not sure if i am doing it right and how to plot the answer system. Can anybody look at my script and give some advise? Im quite new to matlab
Your concept is correct. However you are not calculating the derivatives correctly. You have to step through your *|‘PtV’|* fu...

8 years ago | 0

Answered
Hello! Tell me please, on the basis of what literature is the model made "Muscle Reflex Parameter Estimation" https://www.mathworks.com/help/sldo/examples/muscle-reflex-parameter-estimation.html?s_tid=srchtitle.
MathWorks usually cites the references it uses. This is a simple spring-mass-damper system that MathWorks may have developed it...

8 years ago | 0

| accepted

Answered
How to solve these differential equations?
You can set the equations up easily enough using the Symbolic Math Toolbox: syms C(r) T(r) beta gamma phi Y dC = diff(...

8 years ago | 0

Answered
How to display Intersection of two graphs
You need to create *|‘T_A’|* and *|‘T_R’|* as _anonymous functions_. After that, you can use *|fzero|* to calculate the interse...

8 years ago | 2

| accepted

Answered
Effects of parameter on oscillatory behaviour.
Leave *|‘Kc’|* as a symbolic variable. Then you can vary it in your *|fsurf|* call: A=2; %Cross Sectional Area of the Tan...

8 years ago | 0

| accepted

Answered
How can I write a program that indicates a number if it is integer or not?
Use the <https://www.mathworks.com/help/matlab/ref/rem.html *|rem|*> (link) or *|mod|* (linked to in that page) functions. ...

8 years ago | 0

Answered
My fitness function for timetabling in ga
You need to subscript the *|‘x’|* variables, since they are elements of a vector. You can also create *|‘my_fun’|* as an an...

8 years ago | 0

| accepted

Answered
Curve fitting with 3 variables
There are several ways, depending on what you want to do. I would begin with the Statistics and Machine Learning Toolbox <https...

8 years ago | 0

Answered
How to search a word both uppercase and lowercase given a specified string?
The <https://www.mathworks.com/help/matlab/ref/regexpi.html *|regexpi|*> (link) function is the _case-insensitive_ version of *|...

8 years ago | 0

| accepted

Answered
How to continue the matrix pattern
I can barely read your code and I can’t run the image you posted. That aside, the <https://www.mathworks.com/help/matlab/re...

8 years ago | 0

Answered
How to solve equations with data stored in a cell arrays
I would simply do this: syms a Ind = 13; Rs = 5; Ind = 0:3:15; for i = 1:numel(Ind) Sol{i} = solve((a/...

8 years ago | 1

| accepted

Answered
How to set all elements of a matrix that meet a certain criteria to NaN?
Try this: A(A > 1E+20) = NaN;

8 years ago | 0

| accepted

Answered
Fitting equation to data points
Try this: fy = @(L,Vr,x) (L./Vr)-((L./4.316).*cosd(x)); x = [22.96, 88.2, 114.275, 85.3]; y = [0.1422, 0.157967,...

8 years ago | 1

| accepted

Answered
How to plot solid concentric circles in a meshgrid?
Try this: theta = linspace(0, 2*pi, 100); [X, Y] = meshgrid(1:1:4, theta); a = 0; b = 0; figure(2) plot...

8 years ago | 2

| accepted

Answered
Help with 3D-plotting?
Tweak *|figure(2)|* by adding a *|patch|* call: figure(2) u1 = double(u_1) u2 = double(u_2) syms r v colorma...

8 years ago | 0

| accepted

Answered
How to quickly find the position of a value in a sorted column data?
Try this: V = linspace(-80, 45, 150); % Create Vector B = -78; idx = find(V <= B, 1, 'la...

8 years ago | 0

| accepted

Answered
how to mirror plot in x=4 axis
We do not give complete solutions to homework problems here. I present an approach to an analogous problem to give you a _h...

8 years ago | 1

| accepted

Answered
How to plot line on surface object
*_‘Any suggestion?’_* Experiment with *|plot3|* instead of *|plot|* to plot a line on a *|3D|* plot. *_Example_ —* ...

8 years ago | 2

| accepted

Answered
replace only nonzeroes with per-column text and value
Try this: data = [11,111; 0,222; 33,0; 0,0; 55,555]; strvct = sprintf('foo:%d\tbar:%d\n', data'); result = regexprep...

8 years ago | 0

Answered
How can I use symbolic variables
Try this: rp = sym('rp',[1 10]); for n=1:10 a(n)=sqrt(n*3-1/n); c(n)=a(n)/rp(n); end

8 years ago | 1

| accepted

Answered
How do I solve the transcendental equation to form a vector with the results?
This seems to be homework. You first need to create a function from your equation that you can solve for *|‘x’|* that is also a...

8 years ago | 0

Answered
Rebinning values and for loops
Try this: framedist = randi(9, 1, 90); A = reshape(framedist(:), 30, []); secdist = sum(A) It reshapes *|‘framedi...

8 years ago | 0

| accepted

Answered
Error Undefined operator '*' for input arguments of type 'cell'
The *|inputdlg|* function returns a cell array of strings. You need to redefine *|‘b’|* to a double: b=inputdlg('Enter yo...

8 years ago | 0

| accepted

Load more