Respondida
hi, i am using this code.....alfa = inv([r00 r11 r10 r12; r11 r00 r01 r01;... r10 r01 r00 r02; r12 r01 r02 r00])*[r01 r10 r11 r11]; in which i am getting the error"Error using * Inner matrix dimensions must agree"
Assuming all of your rxx variables are scalars: This is a 4x4 matrix: [r00 r11 r10 r12; r11 r00 r01 r01;... % 1st and 2n...

más de 11 años hace | 0

Respondida
How to make an angle continuous from -inf to +inf
doc unwrap >> p = (pi/180)*[-177 -178 -179 -180 179 178 177] p = -3.0892 -3.1067 -3.1241 -3.1416 3.1241 ...

más de 11 años hace | 1

| aceptada

Respondida
Help saving a vector to the workspace that is output from a function.
How are you calling the function? To get the variables in the workspace make sure you are capturing two outputs. E.g., call ...

más de 11 años hace | 0

Respondida
Question about loop ranges
The obvious guess would be that some of your results are exactly 0 when you get beyond 2000, so the method of cropping the zero ...

más de 11 años hace | 0

Respondida
Help saving the output of a for loop within a function into a vector.
There are vectorized ways to do this (without a loop), but to answer your question directly you could add the index numout onto ...

más de 11 años hace | 0

| aceptada

Respondida
Calling C/C++ code from MATLAB - example
You can start with the mex examples in the doc: http://www.mathworks.com/help/matlab/ref/mex.html

más de 11 años hace | 0

Respondida
How to split a complex vector(H) into equal parts using for loop ?
You could do it with simple indexing k = The set you want to extract (1 = 1st set, 2 = 2nd set, etc) V = H((1:12)+(k-1)*...

más de 11 años hace | 0

| aceptada

Respondida
Evalaute a string left to right
If you will accept evaluating this all at once, here is one way to do it (only works if the rhs is legit MATLAB syntax, which yo...

más de 11 años hace | 2

Respondida
How do I solve this system of coupled differential equations?
Eliminate the 2nd derivative by introducing another variable (i.e., increasing your states). Then you will have a set of 1st ord...

más de 11 años hace | 1

| aceptada

Respondida
Fibonacci sequence, slightly different.
Looks like your indexing into seq is not quite right. Try this: seq(k)=seq(k-1)+begin;

más de 11 años hace | 0

| aceptada

Respondida
Creating new vector wich adds previous value with for loop
b = cumsum(a); To fix your explicit loop, don't set b = 0 at each iteration, and use proper indexing into the vectors. E.g....

más de 11 años hace | 2

Respondida
i dont quite understand the maclaurium series expansion coding
You can look at this link for a lot of information on series expansions: http://en.wikipedia.org/wiki/Taylor_series In par...

más de 11 años hace | 1

| aceptada

Respondida
Asking user for input, returning a matrix
You are close. Just a few syntax things to clear up. input('prompt1') uses the explicit string 'prompt1' as the prompt text. ...

más de 11 años hace | 0

Respondida
question about addressing matrix elements
Yes. The colon operator when used with three values is starting_value:step:ending_value e.g., 5:-1:2 ans = ...

más de 11 años hace | 0

Respondida
Creating a game board for 15-puzzle
You can use reshape to get the random integers into the matrix shape you want. E.g., tiles = reshape(randperm(16)-1,4,4) ...

más de 11 años hace | 1

| aceptada

Respondida
Can I assign a single value to multiple elements of a cell array without a loop
You almost had the syntax right: myArray(find(cellfun(@isempty,myArray))) = {0} Or you can just use logical indexing and...

más de 11 años hace | 2

| aceptada

Respondida
Need 3rd dimension indicies for calling values.
m = size(N2s,1); n = size(N2s,2); [~,x] = max(N2s,[],3); % 3rd dimension indexes of the max locations y = (1:m*n)' + ...

más de 11 años hace | 1

| aceptada

Respondida
creating 30 digits numbers and finding sum
>> "Any idea on how to approach the sum now?" Well, if you had two 30-digit numbers written on a piece of paper, how would yo...

más de 11 años hace | 1

Respondida
Sparse linear system of equations
Are you just asking how to construct B_N? E.g., B_N = spdiags(repmat([-1 2 -1],N,1),[-1 0 1],N,N); A_N = speye(N) -...

más de 11 años hace | 0

| aceptada

Respondida
How to add matrices dimension by dimension without using a loop?
Don't know if this will be faster than your repmat code, but try this: J = bsxfun(@minus,reshape(ldp,1,1,i2,j2,j3),reshape(...

más de 11 años hace | 1

| aceptada

Respondida
Accessing elements in a multilevel structure
The key to the following is that many operations (e.g., Patients.Lesion) return a comma separated list result, so one uses the [...

más de 11 años hace | 2

| aceptada

Respondida
How do I create an auto named variable?
Before you do this you should read this link: http://www.mathworks.com/matlabcentral/answers/57445-faq-how-can-i-create-varia...

más de 11 años hace | 2

Respondida
Using the text command, how can I display a string genrated from sprintf and a string in one line?
text(mean(xlim),max(ylim),sprintf('p = %4d',p_num)) If you need the leading 0's printed then text(mean(xlim),max(ylim)...

más de 11 años hace | 0

Respondida
Help switching variables in a vector using a for loop
You made a good start, but need to fill out the insides of the for-loop. Part d.iii is instructing you to have one line insid...

más de 11 años hace | 0

Respondida
Use matrix c\c++ API with row-based indexing
You could transpose it after loading the mat file. Or you could call MATLAB to transpose it for you prior to saving the variable...

más de 11 años hace | 1

| aceptada

Respondida
Convert binary column vector to decimal
If I understand your question, A is a numeric 52 x 15 matrix consisting of 1's and 0's. For that case you can use: B = bin2...

más de 11 años hace | 3

Respondida
For loop code not working right?
You have used the variable p9 as your loop index AND as the accumulation variable. Use a different variable name for the loop in...

más de 11 años hace | 1

Respondida
Sending big sparse matrix to C through mex: matlab crashing
Sparse matrices are not stored in memory the same way that full matrices are. In particular, the 0's are not physically stored. ...

más de 11 años hace | 2

| aceptada

Respondida
mex File not Recognized
As Jan has already pointed out, "The specified module could not be found" message means that the SMAT_matlabcall.mexw32 file its...

más de 11 años hace | 0

Respondida
Count number of matrix elements in a given vector
M = 30 x j matrix of random ordered numbers 1:30 C = 30 x 1 "correct" ordering of 1:30 N = sum(bsxfun(@eq,M,C)); % Numbe...

más de 11 años hace | 1

| aceptada

Cargar más