Kwan Hee Lee
Kwan Hee Lee

Reputation: 21

working with variables in MATLAB

Btw, I'm new to MATLAB so my questions may be really easy, but I'd appreciate if you guys can help :)

I have:

t = sym('t') and X = [1; sin(2*pi*t); cos(2*pi*t); sin(4*pi*t)];

I want to plot t-x graph, such that:

x(t) = X(1) + X(2) + X(3) + X(4)

How can I do this?

Upvotes: 0

Views: 67

Answers (1)

freude
freude

Reputation: 3832

Try this code, but it is numeric, not symbolic:

t = 0:.01:10;
X=[ones(length(t),1) sin(2*pi*t') cos(2*pi*t') sin(4*pi*t')];
plot(t,X(:,1)+X(:,2)+X(:,3)+X(:,4));

If you really have to use symbolic toolbox of the matlab then study the function ezplot() which is designed for visualizing.

Upvotes: 1

Related Questions