# Problem with mathematical operations

3 Ansichten (letzte 30 Tage)
francis am 6 Jul. 2013
I am having trouble putting this together on matlab
t=0:0.05:.35
v(t)=sqrt((0.0035*(1440)*9.81)/0.0018)*tanh(sqrt(0.0335*(1440)*9.81*0.0018)/(0.035*2700).*t)
all of that is times t and then tanh(t) I tried to work it out and the book says the result a t=0.35 is 0.5120m/s what am I doing wrong thanks for the help
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

the cyclist am 6 Jul. 2013
Bearbeitet: the cyclist am 6 Jul. 2013
I see one specific problem with your code, and a couple potential ones. To help myself see what's going on, I rewrote your code, using parameters instead of inserting repeated numbers into the equation:
t = 0:0.05:.35;
c1 = 0.0035;
c2 = 0.0335;
c3 = 0.035;
a = 1440;
g = 9.81;
b = 0.0018;
d = 2700;
v = sqrt(c1*a*g/b) * tanh(sqrt(c2*a*g*b)/(c3*d).*t);
Notice that I changed v(t) to just v. You are not making a function here, but instead are calculating values of v. [That was probably giving you a syntax error.]
One thing I notice that I find likely to be an typo on your part is that your equation has the three different values that I called c1, c2, c3. Are any of those typos?
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Weitere Antworten (1)

francis am 6 Jul. 2013
Bearbeitet: the cyclist am 7 Jul. 2013
its the problem 3.6 of the matlab book pg 87
r=0.2;
vl=(4/3)*pi()*r^3;
t=0:0.05:0.35;
q=sqrt((vl*1440*9.81)/(0.0018))*tanh(sqrt(vl*1440*9.81*0.0018)/(2700*vl).*t)
the problem was to find the volume of the sphere with the radius of 0.2, I got 0.0335 , I have been checking and still got 0.35s 1.832 velocity
##### 4 Kommentare2 ältere Kommentare anzeigen2 ältere Kommentare ausblenden
the cyclist am 7 Jul. 2013
Found it.
You have an error in your units. The radius of the sphere is 0.2 cm, not 0.2 m.
francis am 7 Jul. 2013
thank you so much,that was the last thing I would of had thought

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by