Answered
Create a vector to prove a sum of series?
Sounds like homework, but I will give you some hints: v = 1:n; % <-- make a vector with the numbers 1, 2, 3, ..., n 1 ./ ...

10 years ago | 0

| accepted

Answered
How to create a matrix with specified numbers in random positions?
m = desired row size n = desired column size f = fraction of 1's to place randomly in result result = zeros(m,n); % p...

10 years ago | 0

| accepted

Answered
How I can solve this equation?
e^(whatever) is coded in MATLAB with the exp() function. E.g., exp(-t/trb)

10 years ago | 2

| accepted

Answered
I am trying to in inverse of a 3x3 symbolic matrix and i keep getting FAIL. it works fine with a 2x2 but how do i get the inverse of a symbolic 3x3 matrix
The rows are dependent, so the matrix is singular, hence the FAIL. row1 + row2 = -row3 I.e., det(A) = 0

10 years ago | 0

Answered
How to use GPU to define a large 3D matrix
For starters, put semi-colons at the end of the delta(etc) = etc lines so that intermediate stuff doesn't print to the screen. D...

10 years ago | 0

| accepted

Answered
how to display in one variable the max of each one of two arrays?
c = [max(a) max(b)];

10 years ago | 1

| accepted

Answered
why - if kk = num (where kk = 6.0000 and num = 6 ) gives me false
The number is close to, but not exactly 6. When a value is exactly 6, MATLAB will display the value without any trailing 0's aft...

10 years ago | 2

| accepted

Answered
Conditional statements not catching
Looks like your code is intended to have arrays as inputs. Because of this, *none* of your if-else-etc checking is going to wor...

10 years ago | 0

| accepted

Answered
why zero to the power of zero is not NaN?
Having 0^0 = 1 is a choice MATLAB made and is in agreement with many authors. But this can either be OK or not OK for your appli...

10 years ago | 1

Answered
Multiply slices of a 4D array with vectors without nested loops? Is there a function comparable to pagefun for the CPU?
Some FEX options to consider (some of them involve mex routines): http://www.mathworks.com/matlabcentral/fileexchange/8773-mu...

10 years ago | 0

| accepted

Answered
I want to use a function that is 1 at x=0 and 0 otherwise.I defined a new function impulse ,but it gives an error not enough input arguments.please help me.
Is this code in a file named impulse.m? And are you calling it as follows? result = impulse(some_input);

10 years ago | 0

Answered
Can I have a code that detects # of element transitions and return a matrix that has only rows of minimum element transitions?
Assuming you compare a row to the previous row and allow at most one element to change, you can use the results of diff(A), coun...

10 years ago | 0

Answered
Could someone explain why the below code shows an error like "FUNCTION keyword use is invalid"? I have attached the code below.
My guess is this is all one script file. You cannot define functions like that in a script file. So split this code into two fi...

10 years ago | 0

Answered
Matrix A & B need to be merged, Can I delete a complete raw if one appears in both matrices and same column position?
This was already answered in your other post, but I will repeat it here. k = ~any(bsxfun(@and,A,B),2); % identify rows wher...

10 years ago | 1

| accepted

Answered
how to rotated a cube 30 deg counterclockwise around the axis that passes through v1 and v8
You can do the following steps: 1) Use v1 and v8 to form a unit rotation axis x 2) Use x and your desired rotation angle...

10 years ago | 0

Answered
what does this command: "@(x) Function" means in matlab?
That's a function handle. See this link: http://www.mathworks.com/help/matlab/matlab_prog/creating-a-function-handle.html?se...

10 years ago | 15

| accepted

Answered
how can I generate a code based on specific value selection in a matrix?
Here is one way as long as x is not too large. This technique will use too much memory if x is too large. b = dec2bin(0:2^n...

10 years ago | 2

| accepted

Answered
Understanding the syntax meaning behind (:,)
The colon : as a subscript simply means "all of the values" for this subscript. So e.g. c(:,j) is all the rows of the j'th colu...

10 years ago | 0

| accepted

Answered
displaying all values from a loop
Is this what you want: con = zeros(size(od)); for n=1:2:11 con(:,n:n+1) = od(:,n:n+1) * E'; end

10 years ago | 0

| accepted

Answered
Help please solve 3nd Order Differential Equation using ODE45
Follow the 2nd Order example given in the doc (the one under "van der Pol equation"): http://www.mathworks.com/help/matlab/re...

10 years ago | 1

| accepted

Answered
Vector search in a loop?
x = find(d==41); d(x) = z(x);

10 years ago | 0

Answered
How would I input the reverse of a natural log code?
result = exp(x) + 5 - exp(1) ./ y; Or maybe you intended something like this: result = exp(x + 5) - exp(1 ./ y);

10 years ago | 0

Answered
Write a function called halfsum that takes as input an at most two-dimensional array A and computes the sum of the elements of A that are in the lower right triangular part of A
Ask yourself, "what does it mean to be in the lower right triangle" in terms of i and j? I.e., what test could you make on i an...

10 years ago | 1

| accepted

Answered
Continious subtraction of a elements in an array
result = diff(A);

10 years ago | 0

Answered
Simple column vector - random number question.
You need to apply the floor() function to rand to get integer results, and your range multiplier isn't quite correct for the ran...

10 years ago | 0

| accepted

Answered
How to efficiently update a matrix in Parallel?
In general, anytime you change elements in a sparse matrix to/from zero to non-zero, the *entire* matrix must be copied in memor...

10 years ago | 0

Answered
Operator ~= matrix dimensions doesn't match
To pick off the cell elements that are not equal to 'False start': pvt(~strcmp(pvt,'False start'))

10 years ago | 0

Answered
how to call fotran code in matlab 7
You can start by reading this documentation and working though the examples: http://www.mathworks.com/help/matlab/programming...

10 years ago | 0

Answered
replacing values in a vector with new value?
v = your vector n = v < 0; % the negative indexes (logical) p = v > 0; % the positive indexes (logical) v(n) = v(n) +...

10 years ago | 0

Load more