Réponse apportée
if x=0
x = input('x value: '); y = input('y value: '); k = x * y; if k == 6 % <-- Use == for equality test k1 = 2; elseif k ...

environ 6 ans il y a | 0

| A accepté

Réponse apportée
Performing calculations on a vector
The log10( ) function is vectorized, so just this result = 20 * log10(4*pi*d./lambda);

environ 6 ans il y a | 0

| A accepté

Réponse apportée
Rename Matrix in Using String
Suppose you could somehow rename your variable to the name contained in filename. What would you do next? How would you access...

environ 6 ans il y a | 0

Réponse apportée
Scalar max of cell array with structure
If you reshape the input first, a one-liner version of your code: peak = max(cellfun(@(x) max(abs(x.noise(:))),myCell(:))); ...

environ 6 ans il y a | 0

| A accepté

Réponse apportée
Sum of sequence with accuracy
exp(-x) will calculate that sum.

environ 6 ans il y a | 1

Réponse apportée
Need help solving this problem with newtons method
To match how you are calling it, you need to switch the order of the arguments in this function handle: F = @(p, t) k*p*(L-p)-a...

environ 6 ans il y a | 0

Réponse apportée
Operators "concatenation" ?
No. MATLAB syntax does not allow using ( ) or { } right after a function call. You could of course create a third function to d...

environ 6 ans il y a | 0

| A accepté

Réponse apportée
Time of sparse matrix components allocation
Every time you add even one element to a sparse matrix, it has to copy data ... perhaps all of the current data ... to make room...

environ 6 ans il y a | 0

Réponse apportée
How to get matrix data from function ,anyone help me
Not sure what the real question is. Maybe this does what you want? function [apZ,atZ]=example(a,Z) apZ = a + Z;...

environ 6 ans il y a | 0

| A accepté

Réponse apportée
Order a string row based on another string row by matching each element (like the sort function does)
One way: [~,idxb] = sort(B1); [~,idxa] = sort(idxb); A1new = A1(idxa); A2new = A2(idxa);

environ 6 ans il y a | 0

Réponse apportée
How to get multiple roots of x
How are you solving it now? Maybe you just need to feed your method different starting guesses.

environ 6 ans il y a | 0

Réponse apportée
Future Bank Account Balance
This line overwrites your old balance vector with a scalar oldbalance = newbalance(i); Instead of keeping track of old balance...

environ 6 ans il y a | 0

| A accepté

Réponse apportée
How to compare elements with above and below element in a column?
Is this what you want? for T = 2:M if( abs(A(T,4) - A(T-1,4)) > 50 ) A(T,4) = 0; end end

environ 6 ans il y a | 0

| A accepté

Réponse apportée
How do I single out elements in a vector?
Hints: You might look at the mod( ) or rem( ) function to determine if values are even. To determine how many are even, you cou...

environ 6 ans il y a | 0

Réponse apportée
Matlab crashes while running MEX Fortran 90 routine
Three comments: 1) You should NEVER, NEVER, NEVER pass literal integers into mex API functions. It can often be the case that ...

environ 6 ans il y a | 0

| A accepté

Réponse apportée
Troubles with data types: integers, doubles, scientific notation, and type casting
You are confusing integer "types" with integer "values". Integer types are int8, uint8, ... int16, uint64. Integer values a 1,...

environ 6 ans il y a | 0

Réponse apportée
Error using * Inner matrix dimensions must agree.
Use element-wise operators (with the dot .) instead of matrix operators (without the dot .), e.g., x1= 1 - (exp(-(t/4))).*(cos(...

environ 6 ans il y a | 0

| A accepté

Réponse apportée
Cant Use Reshape Function with Randi or Randperm
I'm guessing you need to tell this dec2bin call that it always needs to produce 16 digits also: permboxin_temp = dec2bin(permbo...

environ 6 ans il y a | 0

Réponse apportée
Using for loop to match generated random numbers to an input value
Since you don't know ahead of time how many tries it will take, this is best done with a while loop instead of a for loop. E.g.,...

environ 6 ans il y a | 0

| A accepté

Réponse apportée
How can I append a new cell onto the end of a Cell Array?
If F really is a cell array in the format you list, then just C(end+1) = F; If not, then you may have to do this: C(end+1) = ...

environ 6 ans il y a | 0

| A accepté

Réponse apportée
Nonscalar arrays of function handles are not allowed; use cell arrays instead.
You don't need to create an array of function handles. You just need to construct one function handle to use for that iteration....

environ 6 ans il y a | 0

| A accepté

Réponse apportée
Forward Euler method for Higher order differential equation
You need to think of Y as your three element column vector as you have defined. So at each step you are dealing with a column v...

environ 6 ans il y a | 1

| A accepté

Réponse apportée
Subscript indices must either be real positive integers or logicals while k starts from 1 .
The RK4( ) function expects to call the derivative function with the signature F(tt,y), i.e. time is the 1st argument. But your...

environ 6 ans il y a | 1

Réponse apportée
My matrix should be symmetric but isn't by a ridiculous margin
Welcome to the world of floating point arithmetic. This is typical and not unusual behavior. https://www.mathworks.com/matlabc...

environ 6 ans il y a | 0

| A accepté

Réponse apportée
Plot a 100x100 grid of 1's and 0's
Another option: b = your binary matrix spy(b);

environ 6 ans il y a | 0

Réponse apportée
“Dimensions of arrays being concatenated are not consistent”
TYpe this at the command line: dbstop if error then run your code. When the error occurs the code will pause with all current ...

environ 6 ans il y a | 0

Réponse apportée
ODE45 randomly returns vector of length 1.
Try clearing your variables before you run the script. It could be that you are inadvertently using a variable from a previous i...

environ 6 ans il y a | 0

Réponse apportée
Solving System of 1st Order ODEs with Euler's method
The easiest way is to treat your y as 2-element column vectors instead of scalars. E.g., % function file function [x, y] = od...

environ 6 ans il y a | 1

| A accepté

Réponse apportée
Cell Array, Example From Manual
The variable C is only a 2D variable having two dimensions. You have requested indexing into a third dimension with that last...

environ 6 ans il y a | 0

| A accepté

Réponse apportée
sum every n columns, element by element
m = your matrix n = number of columns to sum squeeze(sum(reshape(m,size(m,1),n,[]),2))

environ 6 ans il y a | 1

| A accepté

Charger plus