Answered
Euler's Method (Once again)
See this link under "Formulation of the method": http://en.wikipedia.org/wiki/Euler%27s_method

12 years ago | 0

Answered
How to do Runge Kutta 4 with a second order ode?
What is the signature for ode1? I can't seem to find it in the doc. Where is your derivative function implemented? I don't see i...

12 years ago | 0

| accepted

Answered
how do i obtain several output with a "function" function?
Please see this related post: http://www.mathworks.com/matlabcentral/answers/57445-faq-how-can-i-create-variables-a1-a2-a10-i...

12 years ago | 0

Answered
How to remove the last column in an array
Another method: a(:,end) = [];

12 years ago | 2

Answered
how to create function without having to use all the inputs in the script
Use nargin in your function to determine how many inputs are actually being passed in. E.g. function T = Tavg(a,b,c,d) i...

12 years ago | 1

Answered
Converting Covariance Matrix to Correlation Matrix
A method using outer product and element-wise divide: d = sqrt(diag(cov)); corr = cov./(d*d');

12 years ago | 0

Answered
Allocating values in a 3D array using nested for loops
Since this is apparently a homework assignment, I will get you started. Since the requirement is to use nested loops, I assume t...

12 years ago | 5

| accepted

Answered
mex difference between mwPointer and pointer in Fortran90
An mwPointer is simply a macro that translates into a signed integer (32-bit or 64-bit) in Fortran. It is used to store memory a...

12 years ago | 0

| accepted

Answered
how to normalize a matrix?????
Assuming values are positive, e.g., M = your matrix N = bsxfun(@rdivide,M,max(M)); % Normalized (scaled) matrix by colum...

12 years ago | 2

Answered
Pick out rows one by one from a vector to use as initial values in differential equation?
Do you mean something like this? initial_conditions_matrix = (a 100 x 4 matrix) m = size(initial_conditions,1); for k...

12 years ago | 1

Answered
Error using - Matrix dimensions must agree. HELP
The best course of action usually is to get into the debugger and stop your code at the line that is generating the error, and t...

12 years ago | 0

Answered
&& in if statement returning error
It appears you have a vector involved in your test, e.g., d_0_ij(1:sz_dist_obs(1,1),1) == distance_obs(1,1) As written, ...

12 years ago | 0

Answered
Hot to display a variable from a row ?
Looks like a typo, missing ' in your code. Try this: disp(['m34= ' num2str(m34(j))]);

12 years ago | 2

Answered
mixed programming technology of Matlab and C/C++
Have you looked at the details in the doc? E.g., here: http://www.mathworks.com/help/matlab/programming-interfaces-for-c-c-fo...

12 years ago | 1

Answered
Bug in matlab R2012b version
Others have already adequately answered your question. But to help you gain a better understanding of this I will point you to a...

12 years ago | 3

Answered
Sum(X) = 1 but Sum(X)==1 produces logical 0
Note that when a number is exactly an integer, and you are only printing one scalar value, MATLAB prints it without any trailing...

12 years ago | 0

Answered
Replacing all values except NaN with column number
E.g., y = floor(rand(6,3)*100); y(2:6,3) = nan; % test data z = repmat(1:size(y,2),size(y,1),1); z(isnan(y)) = nan...

12 years ago | 0

| accepted

Answered
How to find number of significant figures in a decimal number?
This is not necessarily trivial to do reliably. In the first place, 31.456 is not representable in IEEE double exactly, so those...

12 years ago | 5

| accepted

Answered
Question about mexfunction link to dll
I usually explicitly put the name of the lib file directly on the mex command. E.g., try something like this assuming the lib fi...

12 years ago | 1

| accepted

Answered
Error in using mldivide in mex
You don't need to create plhs[0] explicitly since the mexCallMATLAB call will do that for you. Also, you don't need to explicitl...

12 years ago | 0

| accepted

Answered
Is there a way to create all m files with already filled in some predetermined lines that are needed for every file like clear all; close all; author name etc?
Have a template file sitting out there (e.g. mytemplate.m) that has a function outline & comments (author etc) already filled in...

12 years ago | 0

Answered
ind2sub doesn't work
The typical use of ind2sub in your case is to request two outputs: [I J] = ind2sub(size(tmp), maxInd) I = 3 J...

12 years ago | 2

Answered
Remove a specific dimension
If you *know* the first dimension is always a singleton at some point in your calculation, you can use reshape instead of squeez...

12 years ago | 8

| accepted

Answered
please help,....how to fix this one,....??? Input argument "D" is undefined. Error in ==> MSA at 2 m=D.m;n=D.n;Ni=zeros(12,12,m);S=zeros(6*n);Pf=S(:,1);Q=zeros(12,m);Qfi=Q;Ei=Q;
The error is saying that you called the MSA function without supplying any arguments. E.g., if you did something like this: ...

12 years ago | 0

Answered
Filter out nonzero number in array of n*2 dimension.
If I understand your question, you want to delete the rows with non-zero entries in both columns, e.g., idx = sum(A~=0,2)==...

12 years ago | 1

Answered
How to add matrices in a function with varying input arguments
Do you mean simply adding up all of the varargin individual inputs, like this? if( nargin ) matrix_sum = varargin{1}...

12 years ago | 1

| accepted

Answered
When to use mex files?
First thing to do is use the profiler and let MATLAB tell you where it is spending most of the time. Then you can decide on what...

12 years ago | 0

| accepted

Answered
Mean Function with Matrix
There *are* five values listed. Each of the five values in the 2nd row is multiplied by the factor 1.0e-3. It is MATLAB's way of...

12 years ago | 2

| accepted

Answered
increase vector with mex function
I don't know about the CUDA stuff, but you have a basic mismatch of types in your C code. E.g., v = ones(100,1); The abo...

12 years ago | 0

| accepted

Answered
Simple mex function help
You have defined x and y in mexFunction to be *pointers* to double, not double. But your xtimes10 routine is expecting double, n...

12 years ago | 1

| accepted

Load more