Respondida
Physics problem help!
So, I will give you a start for an Euler scheme. You have two states to keep track of, the position and the velocity. Define two...

más de 8 años hace | 0

Respondida
code is showing error with some inputs
Why are you using v(1:1) as an index into v? Did you mean this instead? w = v(end:-1:1); Also, it is not clear from you...

más de 8 años hace | 0

| aceptada

Respondida
Confusion in using polyfit and polyval to predict data
Because that is the "time unit" used for your polyfit calls earlier in the code: nz_years_adjust=(nz_years-1900)/50; I.e...

más de 8 años hace | 1

| aceptada

Respondida
Conversion of seconds to date
MATLAB is giving you the result of June 16, 2010 because that is the correct answer for the input of 1907798400. This matches in...

más de 8 años hace | 5

| aceptada

Respondida
How to separate cell rows in different cell??
Do you mean like this? A = yourcell(1,:); B = yourcell(2,:); : etc But if you have lots of rows to deal with...

más de 8 años hace | 0

| aceptada

Respondida
Round down lowest number in a decimal number
E.g., x = whatever result = floor(x*100)/100;

más de 8 años hace | 1

| aceptada

Respondida
Copying dynamic array to MxArray object using memcpy in c++
Two fundamental problems: 1) You can't guarantee that successive calls to calloc( ) will produce memory segments that are adj...

más de 8 años hace | 0

| aceptada

Respondida
How can I find roots of cubic function?
Do you mean like this? syms x y solve('y^3 - (x+50)*y^2 +(500*x -5200)*y + (3600*x) = 0',y)

más de 8 años hace | 0

Respondida
Fibonacci sequence function problem
The fibonacci( ) function was introduced in R2017a. What version of MATLAB are you running? If you are running an earlier ver...

más de 8 años hace | 1

Respondida
Error in fzero function
Use a function handle. E.g., fzero(@(x)x^3+2*a-b,-1)

más de 8 años hace | 0

| aceptada

Respondida
Hi everyone! I need help!
Maybe adding another sum gets the result you want? y(j,i,k) = sum(sum(Mat (:,:,[k]) == Mat(j,i,k)));

más de 8 años hace | 0

Respondida
Bubble sort that stops running when sorted
Typically you have a variable that keeps track of whether you did a swap or not in your most recent loop. E.g., did_a_swa...

más de 8 años hace | 0

| aceptada

Respondida
What happen with my code????, please help me fix this!!
See if this link helps you understand what is going on with your floating point calculations: <http://matlab.wikia.com/wiki/F...

más de 8 años hace | 0

Respondida
Create a matrix with letters
Is this what you want: A = [sym('m%d',[n 1]) sym('x%d',[n 1]) sym('y%d',[n 1]) sym('z%d',[n 1])]

más de 8 años hace | 0

Respondida
Converting Hexadecimal values to Ascii Text
E.g., using the char( ) function: >> h = '41' h = 41 >> d = hex2dec(h) d = 65 >> c = char(d) c = ...

más de 8 años hace | 1

Respondida
problem while applying bisection method "Undefined function or variable 'vbr'
vbr needs to either be a function file (i.e., a file named vbr.m on your MATLAB path), or more likely you should pass that into ...

más de 8 años hace | 0

Respondida
Reshaping/vectorizing a n-d matrix to a vector along each dimension
result = reshape(permute(a,[3 2 1]),[],1);

más de 8 años hace | 0

| aceptada

Respondida
Generating samples of two dimensional random variable
Y = something Z = something result = rand(Y,2*Z); result(:,2:2:end) = result(:,2:2:end) .* result(:,1:2:end);

más de 8 años hace | 0

| aceptada

Respondida
Create a matrix with a repetitive pattern
x = your original vector n = number of vertical repititions result = repmat(x,n,1);

más de 8 años hace | 0

| aceptada

Respondida
Fast computation of 2D summation
T = reshape(B,size(B,1),[]) * A(:);

más de 8 años hace | 0

| aceptada

Respondida
Getting the nonzero mean of each cell element
Can you do this: mean_value = cellfun(@(x)mean(nonzeros(x)),dot_value);

más de 8 años hace | 0

| aceptada

Respondida
how to reshape a matrix using for loop
Try switching the m and n in your for-loop indexing, and use (i,j) for your indexed assignment instead of (m,n). E.g., for ...

más de 8 años hace | 0

Respondida
How do I create an array of answers for the given program? it gives me an error of "Assignment has more non-singleton rhs dimensions than non-singleton subscripts." How can I fix this?
MU is a vector, so the right hand side is a vector. You can't stuff that into a single scalar spot c(i,j).

más de 8 años hace | 0

Respondida
Delete a row from matrix and save the modified matrix as a new matrix?
Ym = Xm; % create a new matrix Ym(3,:) = []; % modify only the new matrix

más de 8 años hace | 1

| aceptada

Respondida
How can I include the derivative of a function as an input to a function handle?
Currently you have a 3-element state vector, with the states being a, b, c. You simply use a 4-element state vector with the 4th...

más de 8 años hace | 0

Respondida
How do I use input to make a string and fprintf to output different parts of the string?
Use the 's' option to read the input as a string. E.g., name=input('enter your name ','s'); Then you can use fprintf wit...

más de 8 años hace | 1

| aceptada

Respondida
FFT implementation by myselft
Use 1/40 instead of 1/20, and modify your inverse formula to account for the -1 difference between the MATLAB indexing (1-based)...

más de 8 años hace | 0

Respondida
How many years are needed to have the INTEREST accumulated above $30,000 USD?
OK. Since you are specifically instructed to use a loop for this, you could start with this rough outline: % Put the initia...

más de 8 años hace | 1

| aceptada

Respondida
Creating a matrix with [xb^2, xb, 1]
A = [xb(:).^2 xb(:) ones(numel(xb),1)];

más de 8 años hace | 1

| aceptada

Respondida
How to create six different matriceses, by changing one value in six different intry's of an existing matrix, using a loop.
x is double class, so you don't use curly braces with that. E.g., x(koor1{i},koor2{i}) = 19; Not sure what the purpose o...

más de 8 años hace | 0

| aceptada

Cargar más