MATLAB: Help on entering velocity formula

velocity

How would I enter "v= πe^(-0.25t) cos(πt)-0.25e^(-0.25t) sin(πt)" into my script ?

Best Answer

Try this:
fontSize = 20;
t = linspace(-3*pi, 3*pi, 800);
v= pi *exp(-0.25*t) .* cos(pi*t) - 0.25 .* exp(-0.25*t) .* sin(pi*t);
plot(t, v, 'b-', 'Linewidth', 3);
grid on;
xlabel('t', 'FontSize', fontSize);
ylabel('v', 'FontSize', fontSize);