
Andrew Newell
Followers: 0 Following: 0
Feeds
已回答
Using AND Operator in “if” statements
The problem is that size returns a vector: size([1 2 3]) ans = 1 3 Instead, use |numel|: if numel([1 2 3])==numel([4 5 6]) &...
Using AND Operator in “if” statements
The problem is that size returns a vector: size([1 2 3]) ans = 1 3 Instead, use |numel|: if numel([1 2 3])==numel([4 5 6]) &...
10 months 前 | 9
| 已接受
已回答
How do I generate a random number with beta distribution?
You can use the function betarnd, but you'll need to do some normalizing to get it in the standard form used by MATLAB (see Beta...
How do I generate a random number with beta distribution?
You can use the function betarnd, but you'll need to do some normalizing to get it in the standard form used by MATLAB (see Beta...
4 years 前 | 0
| 已接受
已回答
Newton Raphson - saving all values and using last iteration value as initial for next
Sorry, I just realized that you wanted to save the iterations. Here's how: x = -0.001*ones(6,length(A1)); for i=1:5 x(i+1...
Newton Raphson - saving all values and using last iteration value as initial for next
Sorry, I just realized that you wanted to save the iterations. Here's how: x = -0.001*ones(6,length(A1)); for i=1:5 x(i+1...
4 years 前 | 0
| 已接受
已回答
Newton Raphson - saving all values and using last iteration value as initial for next
O.k. So here is how you do it: x = -0.001*ones(size(A1)); for i=1:5 x = x - f(x)./fd(x); end
Newton Raphson - saving all values and using last iteration value as initial for next
O.k. So here is how you do it: x = -0.001*ones(size(A1)); for i=1:5 x = x - f(x)./fd(x); end
4 years 前 | 0
已回答
Finding tangent plane with the max range value and z value being equal
Notice that is empty, then try this: X = -1.41:0.01:1.41; [~,idx] = min(abs(X-1)); disp(X(idx)-1) This being floating point...
Finding tangent plane with the max range value and z value being equal
Notice that is empty, then try this: X = -1.41:0.01:1.41; [~,idx] = min(abs(X-1)); disp(X(idx)-1) This being floating point...
4 years 前 | 0
| 已接受
已回答
MatCont for Homotopy Method
The primary purpose of MatCont (which is a GUI front end for Cl_MatCont) is to analyze solution curves of the form . These may b...
MatCont for Homotopy Method
The primary purpose of MatCont (which is a GUI front end for Cl_MatCont) is to analyze solution curves of the form . These may b...
5 years 前 | 0
已回答
Coupled Differential Equations - derivatives on both sides of equations
Let's simplify things a little bit so we can better see what is going on. Let Y = [x; y]; G1(t,Y) = 0.000053+g1(Y(1),t...
Coupled Differential Equations - derivatives on both sides of equations
Let's simplify things a little bit so we can better see what is going on. Let Y = [x; y]; G1(t,Y) = 0.000053+g1(Y(1),t...
8 years 前 | 0
| 已接受
已回答
Why doessn't my code work for compsite simpson one third rule?
You weren't defining the function properly. Try this: func=@(x) 1+exp(-x); See <https://www.mathworks.com/help/matlab/ma...
Why doessn't my code work for compsite simpson one third rule?
You weren't defining the function properly. Try this: func=@(x) 1+exp(-x); See <https://www.mathworks.com/help/matlab/ma...
8 years 前 | 0
已回答
how to continue code in next line with comment between them
You can have the comments beside each part instead: a=b+c+f... % line 1 +t+h+k; % line 2 However, it is possib...
how to continue code in next line with comment between them
You can have the comments beside each part instead: a=b+c+f... % line 1 +t+h+k; % line 2 However, it is possib...
8 years 前 | 0
已回答
Class Property: Array of Objects
You need to define a get method (see <https://www.mathworks.com/help/matlab/matlab_oop/access-methods-for-dependent-properties.h...
Class Property: Array of Objects
You need to define a get method (see <https://www.mathworks.com/help/matlab/matlab_oop/access-methods-for-dependent-properties.h...
8 years 前 | 0
已回答
Series Summation With Function Handles
In principle, you can use |matlabFunction| to get around this difficulty. However, I noticed a couple of issues. First, the summ...
Series Summation With Function Handles
In principle, you can use |matlabFunction| to get around this difficulty. However, I noticed a couple of issues. First, the summ...
8 years 前 | 1
已回答
How to overlay a curve over histogram?
If you already have the curve, then just type |hold on| and plot it. An example: ydata = randn(1000,1); hist(ydata) hold ...
How to overlay a curve over histogram?
If you already have the curve, then just type |hold on| and plot it. An example: ydata = randn(1000,1); hist(ydata) hold ...
8 years 前 | 0
已回答
How to create a new variable for each iteration of a while loop?
Structures are great for this kind of task (see <https://www.mathworks.com/help/matlab/ref/struct.html struct>). Here is an exam...
How to create a new variable for each iteration of a while loop?
Structures are great for this kind of task (see <https://www.mathworks.com/help/matlab/ref/struct.html struct>). Here is an exam...
8 years 前 | 1
已回答
How to store multiple serial objects
You certainly can store them in an array, e.g.: n = 8; s = cell(8,1); for ii=1:8 s{ii} = serial(sprintf('COM1%d',ii-...
How to store multiple serial objects
You certainly can store them in an array, e.g.: n = 8; s = cell(8,1); for ii=1:8 s{ii} = serial(sprintf('COM1%d',ii-...
8 years 前 | 1
| 已接受
已回答
How can I fix my error with the passing a function to another fuction?
The first line should be f = @(x) exp(x);
How can I fix my error with the passing a function to another fuction?
The first line should be f = @(x) exp(x);
8 years 前 | 0
已回答
Integration of norminv function
The problem is that |norminv(x,0,1)| goes to |-Inf| as |x| goes to zero and |Inf| as |x| goes to 1 (and ditto for |y| and |z|), ...
Integration of norminv function
The problem is that |norminv(x,0,1)| goes to |-Inf| as |x| goes to zero and |Inf| as |x| goes to 1 (and ditto for |y| and |z|), ...
8 years 前 | 1
| 已接受
已回答
How to plot a matrix in polar coordinates with color?
I think most approaches will involve converting the coordinates to Cartesian. Here is one approach: v0=10; A=4.*v0./pi;k=1;...
How to plot a matrix in polar coordinates with color?
I think most approaches will involve converting the coordinates to Cartesian. Here is one approach: v0=10; A=4.*v0./pi;k=1;...
8 years 前 | 1
| 已接受
已回答
Nonlinear Tangent (trigonemetric) equation
Before trying to find zeros for a function, it's a good idea to plot it so you understand the nature of the problem. If you do t...
Nonlinear Tangent (trigonemetric) equation
Before trying to find zeros for a function, it's a good idea to plot it so you understand the nature of the problem. If you do t...
8 years 前 | 0
已回答
How to calculate the integral of a function with a spline in it
For evenly or unevenly spaced data, you could use the trapezoidal rule (MATLAB function <https://www.mathworks.com/help/matlab/r...
How to calculate the integral of a function with a spline in it
For evenly or unevenly spaced data, you could use the trapezoidal rule (MATLAB function <https://www.mathworks.com/help/matlab/r...
8 years 前 | 0
已回答
Offseting the y axis to make data more clear
After yyaxis right; use a command like ylim([-0.1 1.5]) to move the axes.
Offseting the y axis to make data more clear
After yyaxis right; use a command like ylim([-0.1 1.5]) to move the axes.
8 years 前 | 0
已回答
Logical Test on Matrix Failing
The variable |little_endian_message| is a char representation of binary numbers. Try this: if( little_endian_message(a) =...
Logical Test on Matrix Failing
The variable |little_endian_message| is a char representation of binary numbers. Try this: if( little_endian_message(a) =...
8 years 前 | 0
已回答
Plots with stairs and inclines?
I'm not sure how you intend to generate the points, but for the example plot you gave, |plot| works just fine with an appropriat...
Plots with stairs and inclines?
I'm not sure how you intend to generate the points, but for the example plot you gave, |plot| works just fine with an appropriat...
8 years 前 | 1
| 已接受
已回答
Quiver Plot Arrows too Wide
Have you tried looking at <https://www.mathworks.com/help/matlab/ref/quiver.html the documentation for quiver>? There is an opti...
Quiver Plot Arrows too Wide
Have you tried looking at <https://www.mathworks.com/help/matlab/ref/quiver.html the documentation for quiver>? There is an opti...
8 years 前 | 0
已回答
Collection many vectors in one matrix
The answer is G = [I1; I2; I3]; See <https://www.mathworks.com/help/matlab/math/creating-and-co%E2%80%A6 Creating and Co...
Collection many vectors in one matrix
The answer is G = [I1; I2; I3]; See <https://www.mathworks.com/help/matlab/math/creating-and-co%E2%80%A6 Creating and Co...
8 years 前 | 1
| 已接受
已回答
How can I speed my function?
One source of delays can be |repmat|. This can be replaced by a suitable choice of index, as in the following: r = R(i,:); ...
How can I speed my function?
One source of delays can be |repmat|. This can be replaced by a suitable choice of index, as in the following: r = R(i,:); ...
8 years 前 | 1
| 已接受
已回答
Overwriting While-loop conditional with +Inf
MATLAB evaluates a logical expression like your |while| condition from left to right. If |a==1|, it knows the expression is fals...
Overwriting While-loop conditional with +Inf
MATLAB evaluates a logical expression like your |while| condition from left to right. If |a==1|, it knows the expression is fals...
8 years 前 | 0
已回答
How to Simplify an symbolic expression
If I define a= 2*atan((-2+sqrt(4-gama^2 *l^2* M^2-4* gama *l* M^2 *tan(gama/2)+4* tan(gama/2)^2-4 *M^2 *tan(gama/2)^2))/(ga...
How to Simplify an symbolic expression
If I define a= 2*atan((-2+sqrt(4-gama^2 *l^2* M^2-4* gama *l* M^2 *tan(gama/2)+4* tan(gama/2)^2-4 *M^2 *tan(gama/2)^2))/(ga...
8 years 前 | 0
已回答
How to load *.mat file from each directories in new script?
Here is a solution that assumes there is one of these |.mat| files in every subdirectory of each of the 15 directories. Let's al...
How to load *.mat file from each directories in new script?
Here is a solution that assumes there is one of these |.mat| files in every subdirectory of each of the 15 directories. Let's al...
8 years 前 | 0
已回答
Old form of legend('string 1','string 2',2) ??
Actually, it's NW (see the <http://www.mathworks.com/help/releases/R13sp2/techdoc/ref/legend.html?s_tid=srchtitle documentation ...
Old form of legend('string 1','string 2',2) ??
Actually, it's NW (see the <http://www.mathworks.com/help/releases/R13sp2/techdoc/ref/legend.html?s_tid=srchtitle documentation ...
8 years 前 | 1
| 已接受
已回答
Finding normals to contours on contour plot
You want curves to follow the gradients. It's easy enough to <https://www.mathworks.com/help/matlab/creating_plots/display-quive...
Finding normals to contours on contour plot
You want curves to follow the gradients. It's easy enough to <https://www.mathworks.com/help/matlab/creating_plots/display-quive...
8 years 前 | 0