Réponse apportée
Solving 2 parameters equation
I see no unknown variable ‘D’ here. Also the variable ‘Lc’ is not defined. Do you mean that Lc and nR are actually the two unk...

presque 10 ans il y a | 0

Réponse apportée
Finding maximum value of y at some x
[~,p] = sort(y,’descend’); x2 = x(p(1:2)); % <-- x values at first and second maxima of y

presque 10 ans il y a | 1

Réponse apportée
Why .^2 does not work as expected?
I think you need to convert I to ‘double’ before doing the exponentiation on it. As it is, I believe it is ‘uint8’ type and any...

presque 10 ans il y a | 1

| A accepté

Réponse apportée
Can I vectorize this any further?
My understanding is that - I admit I haven’t tried this - if you use the ‘bsxfun’ with its ‘fun’ defined as ‘besselj’ and the tw...

presque 10 ans il y a | 0

| A accepté

Réponse apportée
way to avoid for loops
This is for your revised problem involving the 'exp' function. (Note: I am assuming the x and y in your code are just as you ha...

presque 10 ans il y a | 0

Réponse apportée
Generalizing algorithm to find all combinations of sums of vectors.
Let’s suppose that the g’s are the rows in an m by n matrix, G. That is, each n-element row is one of the g’s and there are m o...

presque 10 ans il y a | 0

| A accepté

Réponse apportée
How to set zeros to NaN in specific columns
T = reshape(A(:,2:6),[],1); T(T==0) = nan; A = [A(:,1),reshape(T,[],5)];

presque 10 ans il y a | 1

| A accepté

Réponse apportée
Why does my answer converges? "iterations"
You are apparently trying to solve a quadratic equation in z_v and a cubic equation in z_l. Instead of using the highly questio...

presque 10 ans il y a | 0

Réponse apportée
way to avoid for loops
If x and y are arbitrarily defined as N-by-N arrays, do this: [I,J] = ndgrid(1:N); s = sum(x(:))*I+sum(y(:))*J; Wit...

presque 10 ans il y a | 2

Réponse apportée
nonlinear differential equation system
Your three equations can be reduced to one equation. By using the second two equations it can be deduced that x2 = 2 - x1...

presque 10 ans il y a | 1

| A accepté

Réponse apportée
Inner matrix dimensions must agree.
As it stands, your ‘Z’ variable is empty. You write: “Z=10*10^-2:60*10^-6;”, and the colon operator by default counts up by one...

presque 10 ans il y a | 0

| A accepté

Réponse apportée
Nonlinear 3 equations 3 unknowns , hyperbolic, fsolve stopped because the last step was ineffective
It is relatively easy to convert your three equations in three unknowns into a single equation in a single unknown. That would ...

presque 10 ans il y a | 1

| A accepté

Réponse apportée
[x,y,z] = sphere, except uniform or random distributed points
Here is a way to generate random points on a sphere that is statistically uniform. r = randn(3,n); % Use a large n r =...

presque 10 ans il y a | 4

| A accepté

Réponse apportée
Is there any one who can help me how to sum the following summation expression? I tried but it said to many inputs. Thank you for your help!
The first result with ‘symsum’ very likely indicates that ‘symsum’ is unable to compute this particular infinite sum. The sec...

presque 10 ans il y a | 0

| A accepté

Réponse apportée
how can i determine why my code is accepting a non integer when it's not suppose to
Your instructions specified that if the input is invalid, you were to return an empty string. This you did not do. Instead your ...

presque 10 ans il y a | 1

Réponse apportée
How can i make a code to find y of y''=y*y' ?
To solve your equation numerically using one of the ode functions, you set it up as two simultaneous differential equations: ...

presque 10 ans il y a | 0

| A accepté

Réponse apportée
need help solving this summation
Make these changes in your code: L=3; W=5; x=linspace(0,L,10); y = linspace(0,W,7); N=9; P = 1:2:N ...

presque 10 ans il y a | 1

| A accepté

Réponse apportée
Perimeter of a part of an ellipse
If (x0,y0) is the center of the ellipse, if a and b are the two semi-axis lengths, and if p is the counterclockwise angle of the...

presque 10 ans il y a | 2

Réponse apportée
Using logical operator in an if condition
You are using the "short circuit" logical operators. They work for scalars but not for vectors with more than one element. In ...

presque 10 ans il y a | 0

Réponse apportée
sub2ind gives an error: Error using sub2ind (line 43) Out of range subscript. How to solve this?
Part of your circle has indices of zero value which means the circle extends beyond the limits of K. Move it a little further t...

presque 10 ans il y a | 1

| A accepté

Réponse apportée
FLOPS in Complex Array Multiplication
I count six floating point operations per complex multiplication. If your matrix is N-by-N, that would be a total of 6*N^2 flop...

presque 10 ans il y a | 1

| A accepté

Réponse apportée
What is the problem with this for loop?
For each of the for-loops ‘clock’ can take only one value. For example, with "for clock = 1.000:1.999", clock can only be 1.000...

presque 10 ans il y a | 0

Réponse apportée
why this command: a([],[],:)=A doesn't work? I try not to use for command
As you have defined ax and ay, they are: ax = 1:512; and ay = ones(1,512); Just look at them to see that. This ...

presque 10 ans il y a | 0

Réponse apportée
How can I convert a 3D matrix to 2D matrix in the way specified in this post
result = reshape(permute(val,[1,3,2]),[],size(val,2)); % <-- Corrected

presque 10 ans il y a | 2

| A accepté

Réponse apportée
Random numbers drawn from power law with certain mean
You are correct that the distribution can by generated by b*rand(n,1).^(-D) where b and D are positive parameters. Th...

presque 10 ans il y a | 1

| A accepté

Réponse apportée
How I can extract data from a vector based on index
B = A(setdiff((1:length(A)).’,index(:))); or if you're sure A and index are row vectors just B = A(setdiff(1:length(...

presque 10 ans il y a | 1

| A accepté

Réponse apportée
Engineering Statics Problem in 3 dimensions
Yes, if you wish, you can solve your problem using matlab as follows: c1 = cross([0;0;2],[.2673;.8018;.5345]); c2 = cr...

presque 10 ans il y a | 0

Réponse apportée
How to use the Golden-Section Search for finding the MAX f(x) value?
Finding the maximum would work the same way as with the minimum except that 1) you need to work in an interval for which your fu...

presque 10 ans il y a | 0

Réponse apportée
Integral of controllability gramian
In matlab there is a very important difference between e.^((A.’)*τ) and e^((A.’)*τ) (without the dot.) The first of these is an ...

presque 10 ans il y a | 0

Réponse apportée
I need to extract a row that coincides with a number in the first column.
I agree with Cyclist’s comment as to the lack of clarity in your request, but I will take a very wild guess as to what you are a...

presque 10 ans il y a | 0

Charger plus