Solved


Sum of digits of powers of 2
Given n, first, calculate the number 2^n. Then, sum the digits that comprise that number. For example: Input: n = 7 2^n = ...

10 years ago

Problem


Simpsons's rule (but not Homer Simpson)
I wonder what Homer Simpson would have thought of Simpson's rule? Somehow I doubt his thoughts would have included the phrase Ne...

10 years ago | 4 | 51 solvers

Answered
Explicitly Multiplication of Matrices using For Loops
Well, you do show some code. Lets see how we can write it to help you out. First, understand that a matrix multiply is just a se...

10 years ago | 2

Answered
How can I generate a random binary matrix under some conditions?
This is just blocks of 60 elements. Just generate a random sample using rand, then discard it if it fails your goal. Do that for...

10 years ago | 0

Answered
Maximize L2 norm under linear constraints?
help quadprog Use H = -eye(n,n)

10 years ago | 0

Answered
Does matlab supports rational number types?
MATLAB uses floating point numbers by default. This makes it more efficient to do things like work well on large scale linear al...

10 years ago | 1

| accepted

Answered
Will Matlab online encounter "out of memory" issue?
Yes. You can ALWAYS overwhelm any amount of memory. For a trivial example, just try this: P = perms(1:100); It would att...

10 years ago | 3

Answered
Trying to write a code to approximate a certain singular integral.
Whats the problem? Did you try it? syms x fun = (sin(x.^5)) ./ (x.^(2).*(1+x).^55) I = int(fun,[0,inf]); vpa(I...

10 years ago | 0

Answered
How many bottles do you need to buy before getting all 1-5?
Monte Carlo, in a fully vectorized form. %% simulation of the number of samples needed to get all 5 numbers 1:5. % So a ...

10 years ago | 2

| accepted

Answered
Simultaneous Nonlinear Equations - Using fsolve - Specific Example (Troubleshoot)
You need to learn how to write an expression in MATLAB, in terms of the order of operations. If you don't ABSOLUTELY know how so...

10 years ago | 1

| accepted

Answered
Solving simultaneous non linear equation
Use either vapsolve of fsolve. These are nonlinear equations that will almost surely have no analytical solution. Both of those ...

10 years ago | 0

Answered
How can I solve a nonlinear system with variable coefficient which are updated at every iteration in a for loop? I was thinking of using fsolve but I can't change coefficient in the equations
So, S (the vector of coefficients of this function) is constantly changing (with each iteration) by some arbitrary scheme that o...

10 years ago | 0

Answered
Average of each matrix element due to neighboring elements
The best way? That is however you choose to define it. Only you know the best way, for you that is. To solve the problem, I w...

10 years ago | 0

| accepted

Answered
deep learning matlab toolbox error
You have an old MATLAB release, but are using a demo from a new release of MATLAB. I'll lay down 10 to 1 odds that this data (an...

10 years ago | 1

Answered
I am having difficulties of replacing the matrices may anyone help me
Why would you do this? a(2:4,4:2) = b I can't even guess what you were thinking there. :) Instead: a(1:2,1:4) = b; ...

10 years ago | 0

Answered
Using the deviation of a linear regression calculation to trim the calculated data in the linear regression itself.
These things never seem to work well. I've even tried schemes like this before. The idea looks good. Sort of. But what can happe...

10 years ago | 0

Answered
How to set up an approximately equal conditional statement?
What would this tell you? abs(x - y)

10 years ago | 0

Answered
I am having a difficult time figuring out how to write a script file (non-function) to compute the "Bisection Method" root solution for a given function.
Lets look at your problem. The function is in f, and we are trying to find a root that lies in the interval [3,4]. I'll put a . ...

10 years ago | 0

| accepted

Answered
How can I sum a large (10000x10000) matrix quickly?
Actually, it DOES complete, or it will, eventually. It is just doing some heavy disk thrashing, swapping deeply into virtual mem...

10 years ago | 1

Answered
Forward Kinematics and Reverse Kinematics
So A & B are known matrices. Si is a known vector. OF COURSE IT APPLIES! What A*Si? A known vector. Call it b. So then ...

10 years ago | 1

| accepted

Answered
Differential equations matlab problem, i am not sure how to solve this
You said that you solved it using dsolve. So you know what to do. syms t syms y(t) Dy = diff(y); syms c Y_t...

10 years ago | 0

Answered
Solving an implicit equation for y error
1. Define x and y as syms in advance. So syms x y 2. Is C a constant or is it also symbolic? 3. No need to put quotes...

10 years ago | 0

Answered
spy, making nodes more visible
spy(sprand(10,10,.1)) set(get(gca,'children'),'markersize',50,'color','r') get(gca,'children') ans = Line wit...

10 years ago | 1

| accepted

Answered
The Body of A Symbolic Function
Think about how the MATLAB parser sees it. syms x y s(x,y) = 1 Error using sym/subsindex (line 766) Invalid inde...

10 years ago | 2

| accepted

Answered
How to control the number of fitted parameters when using 'lsqcurvefit'?
I would strongly recommend that you NOT try setting the lower and upper bounds equal. That will introduce a singularity, making ...

10 years ago | 1

| accepted

Answered
level curve of two pdfs
So what is the problem? You have the two pdfs as functions. subtract them. Plot the contour of the difference at zero. Person...

10 years ago | 0

Answered
Can we tag people to a question ?
No. At least, it would do no good. Yes, you COULD in theory add a person's name as a tag. Useless though, and I'd suggest that y...

10 years ago | 4

| accepted

Answered
Hi every one! I have inversed matrix invA from my matrix A (det(A)=!0), but invA*A =! I (identity matrix). Please explain me why?
Note that the product will NEVER be exactly an identity matrix. Floating point trash in the least significant bits will prevent ...

10 years ago | 3

Answered
I am new to matlab. I can't figure out the problem with this code. It won't execute. It's for naive bayes to classify setosa (class = 1) against combined versicolor and virginca (class = 0) without using gaussian pdf
The crystal ball is so foggy. Don't just tell someone that it won't execute. Tell us what DOES happen when you try. If there is ...

10 years ago | 0

Answered
Respected Researchers, I have one problem regarding G.A optimization, for one set of values of decision variables constrained and objective function has been calculated but for same set again it will not work. kindly help me...
So, it works some of the time, but you can't/won't really tell us when it works, certainly not clearly. That may be related to c...

10 years ago | 0

Load more