Answered
extracting arrays from a taylor series and plotting
It looks as though your T is incorrectly computed. For each of three different counts, n = 2, 5, and 50, you need to compute n ...

11 years ago | 1

Answered
Can x、y、z、Y、b and c be derived by constant letters by matlab?
Your question is a rather perplexing one. Variables in matlab can be indicated by any letters. However, you cannot use the sam...

11 years ago | 0

Answered
How to simulate a spherical pendulum in matlab?
Bas, you have a sign error in the gravity term. It should be: -g*sin(phi)/L Use one of matlab's 'ode' solvers to numer...

11 years ago | 1

| accepted

Answered
Link the 2th column of a matrix to the first depending on another matrix.
Perhaps what you need is [~,ix] = ismember(B,A(:,1)); C = A(ix,:); This assumes that every value in B is to be found ...

11 years ago | 0

Answered
Im having trouble finding the mean of a row
Given that matrix_name is 5-by-3, tand(mean(matrix_name,2)).*120 will produce a 5-by-1 matrix, not a 1-by-5. The '2' w...

11 years ago | 1

Answered
how we can solve a determinant
@Arjun. As you undoubtedly are aware, any row of a determinant can be subtracted from another row without changing the value of ...

11 years ago | 3

Answered
How to calculate the means of n adjacent units of a vector?
If you want the mean of each n successive values in A, to place it in X, do this: X = mean(hankel(A(1:n),A(n,end)),1);

11 years ago | 3

| accepted

Answered
How to delete an repeated values in matrix?
If x is your array with repetitions [~,ia] = unique(x,'first','legacy'); x = x(sort(ia));

11 years ago | 0

Answered
The reshape function used in the code below
I would advise you to place the line display(size(img_y)) immediately after the line img_y = uint8(fread(fid, nRo...

11 years ago | 0

Answered
independence in rand function
In a strict sense 'rand' is totally deterministic, since it depends entirely on the seed value with which it starts, and cannot ...

11 years ago | 0

| accepted

Answered
Fibonacci number without any loops?
Here is a formula (not using loops) for the Fibonacci numbers ranging from n = n1 to n = n2: L1 = (1+sqrt(5))/2; L2 = ...

11 years ago | 2

| accepted

Answered
How to write the correct expression of this function?
v = v.^v;

11 years ago | 1

| accepted

Answered
How to generate the following matrix
y = repmat(x,10,1); y(:,1:2) = y(:,1:2) + repmat(5*floor((0:29).'/3),1,2);

11 years ago | 1

| accepted

Answered
I need help with matrix size confliction in code
The error refers to the element-by-element multiplication "w.*tt". You are attempting to multiply the three elements of row vec...

11 years ago | 1

| accepted

Answered
Undefined function or method in function
Since you are not passing 'Observed' to 'my_fum' as a function argument, you must make its value known to the function as a para...

11 years ago | 0

| accepted

Answered
How to give g variable (which is vector) into char() function
Study this carefully: http://www.mathworks.com/help/matlab/ref/char.html

11 years ago | 0

Answered
Non- linear equation system
I would suggest you temporarily disregard the equation with f4 and regard x2 as a known parameter. That leaves you with five li...

11 years ago | 0

| accepted

Answered
Solve equation x^(0.7)-x^(-0.3)==1 get wrong answer??
I think I can account for the extraneous "solution" you received. If you substitute x^(0.1) = y, which can be expressed as x = ...

11 years ago | 2

Answered
Please please help fix my error!
In the equation for 'cvH2' you are doing a matrix right divide when you use "/" without the dot. You are doing a matrix divisio...

11 years ago | 0

Answered
a sequence of a sum of product
You can vectorize your summation. I assume H is a 10-element row vector as you have shown it. h = zeros(10,1); for p ...

11 years ago | 1

| accepted

Answered
Slope along the curve
If the X values are not uniformly-spaced, the expression (Y(i+1)-Y(i-1))/(X(i+1)-X(i-1)) is not a very accurate approxi...

11 years ago | 1

Answered
1st graph plots fine, 2nd graph is an error.
You cannot plot three variables in two dimensions! Either use plot3 or else plot only two of your variables. For example, plot...

11 years ago | 0

Answered
How to speed up 2 loops with the intersect function?
Some possible improvements: 1) You could compute 'Qnor' in the following way: if k<=1 Qnor(i,1) = 1; else ...

11 years ago | 0

| accepted

Answered
How to combine this value ?
If you want all twenty values to be stored in 'sol', you need to move the line j1=1; to execute before entering the out...

11 years ago | 0

Answered
Simple Question: gradient function Formula
For 2 <= k <= 199, the computation is a central difference: a(k) = (x(k+1)-x(k-1))/(2*h) However, for the two endpoints...

11 years ago | 2

| accepted

Answered
I'm new to Matlab...never used it before and I need help with calculating reimann sums
Assuming x and y are vectors of the same length with corresponding x- and y-values, do this: Ls = sum(y(1:end-1).*diff(x))...

11 years ago | 0

Answered
Half life question in matlab
Bradley, just ask yourself, "what power of 2 do I have to divide 50 by to get 20?". Then that power should be the ratio of the ...

11 years ago | 0

Answered
Problem using diff comand
I am guessing that your difficulty is due to the low number of digits accuracy, namely only 3, that you requested. Write ...

11 years ago | 0

Answered
How to create a function that returns a matrix with one more popped piece randomly added and the location of it.
Use 'randi' twice to generate random indices for the row and column and then add 1 there.

11 years ago | 0

| accepted

Answered
How can I get different 2D Matrices from a 3D matrix?
Use matlab's 'squeeze' function to eliminate the singleton dimension(s).

11 years ago | 0

Load more