답변 있음
Can not use the Fibonacci built in function
For simplicity, let's assume you don't know how many iterations you need in advance. So start with your current code: while x <...

6년 초과 전 | 0

답변 있음
Trapezoidal rule in a for loop
You made a good start, but there are several problems with your summation. You don't accumulate into your trapez variable, you ...

6년 초과 전 | 0

| 수락됨

답변 있음
Why is my own echelon function printing incorrect matrix
I haven't checked all of your code, but I assume this: if ~all(A(k,:))==0 %check to see if row of zeros or not was meant to be...

6년 초과 전 | 0

| 수락됨

답변 있음
(1/x)>2 . why x<(1/2) is Not the answer
When you multiply (or divide) an inequality by a value, the direction of the inequality changes if the value is negative. So whe...

6년 초과 전 | 0

답변 있음
How to compare element between two numbers
Like Rik, I am not sure what comparison you are doing based on your terse description. Maybe this, but it doesn't match your st...

6년 초과 전 | 0

답변 있음
[mexFunction in Matlab] printf() function in C code
How you have it written should work, except maybe replace printf( ) with mexPrintf( ). Also, depending on your compiler and sett...

6년 초과 전 | 0

답변 있음
How to return the outputs of mexFunction() in Matlab?
Put this at the bottom of your code. But remember that if you call mexErrMsgTxt your mex function will exit immediately and not ...

6년 초과 전 | 1

답변 있음
Error: Matrix dimensions must agree
You could use V(2:end) or V(1:end-1) instead of V in that line. Or maybe average the two.

6년 초과 전 | 0

| 수락됨

답변 있음
Write a MATLAB code to estimate the exponential function. Inputs should be x and n. The outputs must include approximate value, true value, error, absolute error, and relative error.
Put your function code for e_to_x() in a separate file called e_to_x.m somewhere on the MATLAB path. Then put your other code t...

6년 초과 전 | 0

답변 있음
Kindly give me the Matlab code for simplex method?
Use the MATLAB supplied function fminsearch.

6년 초과 전 | 0

| 수락됨

답변 있음
Error when calling the mexFunction
You probably should have gotten a warning from the compiler that your callFun( ) function doesn't return anything, even though t...

6년 초과 전 | 0

| 수락됨

답변 있음
How to turn assigned vectors into a 3x3 matrix?
Assuming vec3 is a typo, result = [vec1;vec2;vec3]; If you need to, you can transpose the result. If your vec3 is not a typo,...

6년 초과 전 | 0

답변 있음
[Create mexfunction from C code] The order of several c files
The order you compile your source code files should not matter (other than the fact that the mex function name will be based on ...

6년 초과 전 | 0

답변 있음
When I try to run a function in matlab, I get an error, it is undefined
Put this code in a file called checkEchelonMatrix.m that is on the MATLAB path: function [result] = checkEchelonMatrix(M) %res...

6년 초과 전 | 0

| 수락됨

답변 있음
Memory erased in mex file
I would highly advise combining your multiple mex routines into one mex routine that you call with a directive (e.g., a string) ...

6년 초과 전 | 0

| 수락됨

답변 있음
Sort Index - Bug
The sort index gives the location in the original array of the sorted values. I.e., the sort results "a" are "original_array(sor...

6년 초과 전 | 2

답변 있음
[Create mexfunction from C code] warning: implicit declaration of function
You call myfunction( ) before the compiler has seen a prototype or definition of myfunction( ). Either move your square( ) and ...

6년 초과 전 | 0

| 수락됨

답변 있음
Index Exceeds Matrix Dimensions
You have inadvertantly created variables named "dot" and "cross" that are shadowing the MATLAB functions of the same names. Cha...

6년 초과 전 | 0

답변 있음
Saving all outputs of for for-loop
Basic steps for you to take would be: Create your range up front, and not as part of the loop indexing. E.g., a t vector Use t...

6년 초과 전 | 0

답변 있음
How can we create a vector of length n
There are many ways of doing this. E.g., use the ones( ) function and divide by 10. Or use the zeros( ) function and add 1/10....

6년 초과 전 | 1

| 수락됨

답변 있음
Create matrix indicating combinations of dummy variables
Variations of this technique are often used, but this can exceed your memory if n gets too large: n = 8; result = dec2bin(0:2^...

6년 초과 전 | 0

| 수락됨

답변 있음
Solve the limit limx→0
Hint: If you are just looking to get an answer, consider looking at the Taylor Series of each individual term and then ask yours...

6년 초과 전 | 0

답변 있음
Filling a matrix without for-loops and ifs
Check out the sub2ind( ) function: https://www.mathworks.com/help/matlab/ref/sub2ind.html?searchHighlight=sub2ind&s_tid=doc_src...

6년 초과 전 | 0

답변 있음
Vectorizing evaluation of cell array of functions
Not sure this will be any faster since the loop is just hidden, but you can try this: output = arrayfun(@(x,y)x{1}(y),funcell,i...

6년 초과 전 | 1

답변 있음
Wondering if you have any merchandise for sale cause I'd love to look like a part of the MATLAB team ?
How about a MATLAB/Simulink Rubik's Cube? https://www.ebay.com/sch/i.html?_from=R40&_trksid=m570.l1313&_nkw=matlab+rubiks&_saca...

6년 초과 전 | 0

답변 있음
Is there a matlab function similar to numpy.spacing
From the numpy.spacing doc: "It can be considered as a generalization of EPS ... there should not be any representable number ...

6년 초과 전 | 3

| 수락됨

답변 있음
What is the best way to insure that all of my functions are using the same constant values?
I use a function that returns a structure, containing the values and the unit descriptions. Your code can either pass this stru...

6년 초과 전 | 4

답변 있음
Separate out every fourth element of a Vector
V = your vector result = V; result(4:4:end) = []; % remove every 4th element The above syntax with [] on the rhs is special ...

6년 초과 전 | 0

| 수락됨

답변 있음
How to extract the value of dydt from ode45 function
Why can't you just call your odefcn( ) function with your solution t and xSol vector elements as inputs (e.g., in a loop)? Does...

6년 초과 전 | 1

| 수락됨

답변 있음
How to make an assignment for my for loop?
This syntax with the curly braces next to SBOS means it is a cell array: SBOB{ whatever } But this syntax with the dot notatio...

6년 초과 전 | 1

| 수락됨

더 보기