Respondida
continue, how to skip part of a cycle
Your if-test and continue statement are inside the inner while loop, so they apply to that loop, not the for-loop. Maybe use a b...

casi 10 años hace | 0

| aceptada

Respondida
Matrix Element Transfer from one matrix to another
I am not quite clear what you are asking. Is it something like this? >> A = reshape(1:100,10,10) % <-- test data A = ...

casi 10 años hace | 1

Respondida
Matlab M-File
You should review the documentation on how to write a function, since your above code is not a correctly written function. First...

casi 10 años hace | 1

| aceptada

Respondida
how to write Derivative code ?
If you can use anything except diff(), and you only want to allow simple polynomials, then use polyder() for the derivative (alo...

casi 10 años hace | 0

Respondida
Ode45 producing NaN values only
I haven't looked over your code in detail, but this definitely looks funny: for i = 1:N for j = 1:N : ...

casi 10 años hace | 1

| aceptada

Respondida
Write a function [M] = myMax(A), where M is the maximum value in an array A. Don't use the built-in MATLAB function max. Then write a function (M) = myNMax(A,N) where M is an array consisting of the N largest elements in A using the myMax function.
Thanks for making an attempt and posting your code. It is unclear from your post if the function is supposed to operate on arbit...

casi 10 años hace | 1

Respondida
Matlab Trigonometry and built in functions
You are missing the /2 inside the cosine on the lhs. E.g., >> cos((pi/5)/2)^2 ans = 0.904508497187474

casi 10 años hace | 1

| aceptada

Respondida
Creating a randomly generated sentence in MATLAB
randi would be a natural choice here. E.g., for the pieces: greet{randi(numel(greet))} flatter{randi(numel(flatter))} ...

casi 10 años hace | 1

| aceptada

Respondida
Would you please help me to correct this code?
Try this code (assumes spot_length is not too large): nrows = 4; % Number of rows ncols = 2; % Number of column spots ...

casi 10 años hace | 1

Respondida
naming matrix with a specific pattern
Please don't do this! It will be very hard to maintain your code. See this link for alternatives: http://www.mathworks.com/ma...

casi 10 años hace | 2

| aceptada

Respondida
How can I extract a specific row of data from each column of a matrix
X_Y = X(Y + (0:numel(Y)-1)*size(X,1));

casi 10 años hace | 0

Respondida
How to not display the output of a function?
Put a semi-colon at the end of the line. E.g., x = myfunction(stuff) <-- will display the result to the screen x = myf...

casi 10 años hace | 2

| aceptada

Respondida
How to speed up (or avoid) data copy from C matrix to mxArray?
No. You cannot mix C/C++ native memory with mxArray's. That will mess up the MATLAB memory manager and lead to an eventual crash...

casi 10 años hace | 0

Respondida
Splitting up a matrix - how can I do it more efficient?
This keeps the submatrices in column-order in memory as your example seems to do: Asplit = reshape(permute(reshape(A',size(...

casi 10 años hace | 0

Respondida
Variables number of for loops using recursion
Does this do what you want (assumes all of the f values are positive integers): function forloops(d,f) n = ones(1,numel(...

casi 10 años hace | 0

Respondida
I am trying to create a function form a vector from my matrix and I do not understand where my mistake is?
Here is an outline of what you need to be using for the for loops (seems to be a requirement for this assignment). % Inse...

casi 10 años hace | 0

Respondida
Array of unknown length but known upper bound: Pre-allocate then strip or build as you go?
If the memory requirement isn't too large, then just go with Option 1. That will be easy to program anyway, and will likely min...

casi 10 años hace | 3

Respondida
Converting a std::vector<float> to mxArray using ocvMxArrayFromVector
I don't know about the ocvMxArrayFromVector routine, or how to advise you to link everything in properly, but here is a short ex...

casi 10 años hace | 2

Respondida
numeric solution to matrix ODE with matrix
Generally, the only thing you need to use for this is the reshape function. It doesn't matter how "complex" your matrix stuff is...

casi 10 años hace | 0

Respondida
How can I improve speed of strcat in a for loop?
Do you need "code" inside the loop for some reason? If not, why not construct it once outside the loop? E.g., something like t...

casi 10 años hace | 1

| aceptada

Respondida
fopen is not being supported in my MATLAB version. What else can I use?
Do you have the fopen function shadowed by another function or variable? What does this show: which -all fopen

casi 10 años hace | 0

Respondida
Solving an unknown with a ln
Can't you just substitute your expression and then divide by the appropriate value?

casi 10 años hace | 1

| aceptada

Respondida
how to locate rows that has max values in r*2 matrix?
E.g., assuming you always want two rows (which might be the same): [~,rows] = max(x,[],1); M = x(sort(rows),:); If yo...

casi 10 años hace | 1

| aceptada

Respondida
How to use Euler's method to solve the logistic grown model?
One step of Euler's Method is simply this: (value at new time) = (value at old time) + (derivative at old time) * time_step ...

casi 10 años hace | 0

| aceptada

Respondida
generate sample from a normal distribution
doc mvnrnd

casi 10 años hace | 0

| aceptada

Respondida
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 ./ ...

casi 10 años hace | 0

| aceptada

Respondida
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...

casi 10 años hace | 0

| aceptada

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

casi 10 años hace | 2

| aceptada

Respondida
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

casi 10 años hace | 0

Cargar más