How can I plot accleration in the x, y, and z directions? Each accerlation coordinate a(x,y,z) is associated with a moment in time.
Would a simple 2D plot suffice? E.g., plot(t,x,t,y,t,z); grid on legend('x','y','z'); xlabel('time') ylabel('acceleration'...

19 dagar ago | 1

how to write the this in matlab e^((x^-1)/2) -1
y = exp((x.^2-1)/2) - 1; See the Getting Started section of the doc for initial help on writing MATLAB code.

20 dagar ago | 0

| accepted

Save serial datenum as decimal, not scientific notation
First, MATLAB stores all doubles the same way ... as IEEE binary floating point format. What you are seeing as "737389.4167 beco...

20 dagar ago | 0

Breaking changes for C++ API?
The current online doc for mxCreateStructMatrix( ) says the last argument must contain "... one or more field names ...", which ...

20 dagar ago | 0

Writing a funciton for e^x values?
You use the same n value for the first three terms. You need to increment n each time you add a term, including the first two t...

21 dagar ago | 0

Trying to write a function for the inverse of a matrix.
You are missing the part where you append the identity matrix to the right side of A before you start your Gauss elimination. So...

21 dagar ago | 0

mex fortran code containing intrinsic function using Intel fortran compiler
Can you post the offending code? Maybe you are calling it with a non-real argument and the compiler is complaining that it can't...

21 dagar ago | 0

How to re-prompt user input if given incorrect value?
str2double will turn your inputs into numeric, so you will pass your isnumeric( ) test even if there are problems. Instead, chec...

22 dagar ago | 0

| accepted

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

22 dagar ago | 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 ...

22 dagar ago | 0

| accepted

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

22 dagar ago | 0

| accepted

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

23 dagar ago | 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...

23 dagar ago | 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...

23 dagar ago | 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 ...

24 dagar ago | 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.

25 dagar ago | 0

| accepted

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

25 dagar ago | 0

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

25 dagar ago | 0

| accepted

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

25 dagar ago | 0

| accepted

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

26 dagar ago | 0

[Create mexfunction from C code] The order of several c files
The order you compile your source code files should not matter. The error seems to be that the compiler can't find the resource...

26 dagar ago | 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...

26 dagar ago | 0

| accepted

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

26 dagar ago | 0

| accepted

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

26 dagar ago | 1

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

26 dagar ago | 0

| accepted

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

27 dagar ago | 0

| accepted

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

27 dagar ago | 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...

27 dagar ago | 0

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

27 dagar ago | 0

| accepted