## How do I solve dm/dt = R(1-A) - B (A) in MATLAB?

### dafdfab (view profile)

on 19 Nov 2012
Accepted Answer by Walter Roberson

### Walter Roberson (view profile)

I have this equation:

```dm/dt = R(1-A) - B (A)
```

I need to solve A when:

```dmdt= 0
R =0.1
B= 0.2
```

I am able to solve it by hand, but how can I solve this problem in MATLAB? Can I set this as a function?

Jan Simon

### Jan Simon (view profile)

on 23 Nov 2012

@dafdfad: Destroying the question after an answer is given does not meet the intention of this forum. It is a counter-productive method. Please stop this.

Randy Souza

### Randy Souza (view profile)

on 29 Nov 2012

I have restored the original text of this question.

dafdfad, this question has a clear subject and an accepted answer, so it may be valuable to someone else in the future. If you have a good reason why it should be removed from MATLAB Answers, please flag the question, explain why it should be deleted, and an administrator or high-reputation contributor will consider deleting the question. Please do not simply edit your question away.

## Products

No products are associated with this question.

### Walter Roberson (view profile)

Answer by Walter Roberson

### Walter Roberson (view profile)

on 19 Nov 2012

If you have the symbolic toolbox,

```syms A
R = 0.1
B = 0.2
Asol = solve( R*(1-A)-B*A, A)
```

dafdfab

### dafdfab (view profile)

on 19 Nov 2012

thank you soooo much walter

dafdfab

### dafdfab (view profile)

on 19 Nov 2012

the answer given is right, but I am just having trouble understanding it. in the code dmdt did not appear at all, so the solve function automatically assume the whole equation equals to zero?

Walter Roberson

### Walter Roberson (view profile)

on 19 Nov 2012

I left that part out as it is 0.

```syms A
R = 0.1
B = 0.2
dmdt = 0
Asol = solve( (R*(1-A)-B*A) - dmdt, A)
```

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi