Risposto
How can I add 1 to a particular element in a matrix?
M = your 13x13 matrix M(1,2) = M(1,2) + 1;

circa 6 anni fa | 0

| accettato

Risposto
How to determine Simplex using Nelder-Mead Algorithm in all direction?
The Nelder-Mead Simplex Method is an adaptive method that adjusts the lengths and directions dynamically. The vertices could be ...

circa 6 anni fa | 0

Risposto
Question on why tilde cannot return the opposite statement result
Precedence of ~ is hgher than >, so it gets performed first. You need to use parentheses: ~(adultdata.age>50)

circa 6 anni fa | 0

| accettato

Risposto
A single column vector or an array, which is faster?
Other things you are doing in your code are likely to dominate run times. We would need to see your particular application to of...

circa 6 anni fa | 0

| accettato

Risposto
Matrices and indexing ?!
[LX,LY] = ndgrid(Lx,Ly); z = LX(:)./LY(:) <= 2; LX = LX(z); LY = LY(z); LX and LY contain the number pairs that match the co...

circa 6 anni fa | 0

Risposto
Sort rows of matrix by matching column with another matrix column
E.g., assuming everything in column 31 has a match [~,x] = ismember(A(:,31),B(:,31)); Bsort = B(x,:);

circa 6 anni fa | 1

| accettato

Risposto
how to find max value of a function with a for loop
Make e a vector. E.g., for i=1:length(x) e(i) = y(i) - (m*x(i)-b); % <-- Are you sure that isn't supposed to be (m*x(i) +...

circa 6 anni fa | 1

| accettato

Risposto
How to solve a system of ODEs and plot the result
This is where you needed to show us the complete code and the complete error message. It is probably complaining about your init...

circa 6 anni fa | 0

| accettato

Risposto
precision of calculation with Matlab
Calculators may not use the same floating point representations or arithmetic routines that MATLAB uses, so differences in the t...

circa 6 anni fa | 0

Risposto
How to code for this equation in Matlab
Assuming that f(x) is really supposed to be f(t): f = @(t)exp(j*w*t); But, you will need to have w defined prior to this.

circa 6 anni fa | 0

| accettato

Risposto
Mex C file generation Linker library error
Do you already have a zzz.lib file? Normally to get your mexFunction code to link to the library you simply include it as part ...

circa 6 anni fa | 0

| accettato

Risposto
rand command give different answer
rand( ) is a random number generator ... it is supposed to give a different result. doc rand If you want to start over with th...

circa 6 anni fa | 1

Risposto
Help creating an array to hold approx error from a taylor series
Generally, just index into your variable inside the loop: a_values(index) = a_err; If the indexing could be large, you would a...

circa 6 anni fa | 0

Risposto
What is the Aerospace Blockset quaternion convention?
See also the Answer in this post: https://www.mathworks.com/matlabcentral/answers/465053-rotation-order-of-quatrotate

circa 6 anni fa | 0

Risposto
angle between three points (in 3D)?
See the discussion in these links: https://www.mathworks.com/matlabcentral/answers/101590-how-can-i-determine-the-angle-between...

circa 6 anni fa | 0

Risposto
How to convert char to uint8 and vice versa without changing the underlying data
Simply: c = original char array u = uint8(c); Or u = original uint8 array c = char(u); If you mean you want to reinterpret...

circa 6 anni fa | 0

Risposto
Multiplying each column of a matrix with a specific value
mat=[2,1,0,0;1,0,0,0;0,0,0,1]; % 2D matrix f = [25,5,10,1]; % row vector result = f .* mat; % element-wise multiply with virtu...

circa 6 anni fa | 0

| accettato

Risposto
Creating Unit vectors in a loop
Since a complete answer has already been posted, I will post this one using a cell array result which will be much easier to ind...

circa 6 anni fa | 1

Risposto
When i run this code i get error using dec2bin (too many input arguments).
MATLAB is case sensitive. Text (uppercase T) is different from text (lowercase t). In the future, please post the complete erro...

circa 6 anni fa | 0

Risposto
Maclauren Series Iteration. Answer provided just having trouble getting code to run properly
Some issues: 1) This line: new_cos=(old_cos-(x^n))/(factorial(n)); You are dividing the old_cos by the factorial(n). This do...

circa 6 anni fa | 1

| accettato

Risposto
Model a simple circular satellite orbit in time
Since you are setting up a circular orbit, just scale the time by the period to get theta. E.g., since one period would be an an...

circa 6 anni fa | 0

| accettato

Risposto
Question: Create a function that takes a generic matrix, x, and finds the smallest value in the matrix.The function must work for matrices of any size and dimension.
Hint: First reshape the input x array into a 1D vector and work with that inside your function.

circa 6 anni fa | 1

| accettato

Risposto
How to wrap on overflow when transfer a double to integer
You could use: y = mod(x,double(intmax('uint16'))+1); But, if x is too large so that eps(x) > 1 the result might be somewhat m...

circa 6 anni fa | 1

| accettato

Risposto
Finding all multiples of 5 or 7 from 1 to 10000 with a loop.
An basic outline of the for loop to get you started: n = 10000; % the limit of the for loop x57a = []; % initialize the result...

circa 6 anni fa | 0

Risposto
What type of function Matlab has help to construct symmetric matrix?
If no specific properties needed, then you could use n = the desired size M = rand(n); M = M + M';

circa 6 anni fa | 1

Risposto
Matrix dimensions must agree error in FOR loop
This comparison: z == 'no' compares z to a 1x2 array. And this comparison z == 'yes' compares z to a 1x3 array. So you are...

circa 6 anni fa | 0

Risposto
Calling C functions using MATLAB.
This: void (*camp)(double x, double *y, int n, double *f) is not a function as you claim. It is a pointer to a function that ...

circa 6 anni fa | 0

Risposto
Can't figure out what I am doing wrong. Looking to find square root using the equation given x=(x+x/a)/2. I also feel like I am not making use of the approximation errors ea and es.
You can't do these assignments in this order: x_old=x; ea=((x-x_old)/x)*100; The first one will cause the second one ...

circa 6 anni fa | 1

Risposto
Coupled second order ODE with three variables
Problems: 1) Units. You really should annotate ALL of your constants with descriptions and units so that the reader knows what...

circa 6 anni fa | 0

Carica altro