need help in plotting curve

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

need help in plotting curve

navshinder
hi,
I'm trying a dynamics problem and trying to plot the displacement with
respect to time function.  However I'm returned with an error message
"subscripts must be either integers 1 to (2^63)-1 or logicals
error: called from
    utvst at line 7 column 3"
which I'm not able to figure out
thanks

t = linspace(0,0.01,500);
x0 = 0.01;
xdot0 = 0.1;
m = 40;
k = 3500;
omega = sqrt(k/m);
ut = sum((x0.*cos(omega.*t))+((xdot0/omega)(sin(omega.*t))));
plot(ut,t)




--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html


Reply | Threaded
Open this post in threaded view
|

Re: need help in plotting curve

karl
Am 17.09.19 um 19:33 schrieb navshinder:

> hi,
> I'm trying a dynamics problem and trying to plot the displacement with
> respect to time function.  However I'm returned with an error message
> "subscripts must be either integers 1 to (2^63)-1 or logicals
> error: called from
>      utvst at line 7 column 3"
> which I'm not able to figure out
> thanks
>
> t = linspace(0,0.01,500);
> x0 = 0.01;
> xdot0 = 0.1;
> m = 40;
> k = 3500;
> omega = sqrt(k/m);
> ut = sum((x0.*cos(omega.*t))+((xdot0/omega)(sin(omega.*t))));
> plot(ut,t)
>
>
>
>
> --
> Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
>
>
Looks to me as if in the line ut=... there is missing a * between

(xdot0/omega) and (sin(omega.*t))
.

(xdot0/omega)



Reply | Threaded
Open this post in threaded view
|

Re: need help in plotting curve

Doug Stewart-4
In reply to this post by navshinder


On Tue, Sep 17, 2019 at 2:13 PM navshinder <[hidden email]> wrote:
hi,
I'm trying a dynamics problem and trying to plot the displacement with
respect to time function.  However I'm returned with an error message
"subscripts must be either integers 1 to (2^63)-1 or logicals
error: called from
    utvst at line 7 column 3"
which I'm not able to figure out
thanks

t = linspace(0,0.01,500);
x0 = 0.01;
xdot0 = 0.1;
m = 40;
k = 3500;
omega = sqrt(k/m);
ut = sum((x0.*cos(omega.*t))+((xdot0/omega)(sin(omega.*t))));
You need a * or +  at here ----------------------------^
 
plot(ut,t)




--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html




--
DASCertificate for 206392



Reply | Threaded
Open this post in threaded view
|

Re: need help in plotting curve

navshinder
In reply to this post by karl
thanks a ton
being a newbie, I couldn't figure out this simple thing



--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html