Effacer les filtres
Effacer les filtres

Simple Question: How to Plot a Function over an Interval (Details in Body)

2 vues (au cours des 30 derniers jours)
Michael Meyne
Michael Meyne le 12 Sep 2023
Hello, it's been too long since I've used Matlab.
Could someone please help me with the following? I tried looking online but other solutions didn't help me for some reason. Thanks in advance!
t = 0:0.01:pi % Theta from 0 to pi
tm = sqrt(44*cos(t).^2 + 44*cos(t)*sin(t)+29*sin(t).^2)
plot(t, tm(t))
  3 commentaires
Torsten
Torsten le 12 Sep 2023
Modifié(e) : Torsten le 12 Sep 2023
t = 0:0.01:pi; % Theta from 0 to pi
%
tm = sqrt(44*cos(t).^2 + 44*cos(t).*sin(t)+29*sin(t).^2); % traction magnitude eqn derived on paper
plot(t, tm)
Michael Meyne
Michael Meyne le 12 Sep 2023
Thank you Torsten!

Connectez-vous pour commenter.

Réponses (1)

Sam Chak
Sam Chak le 12 Sep 2023
Alternatively, you can also use fplot() to symbolically plot the function over the specified interval for t.
syms t
tm = @(t) sqrt(44*cos(t).^2 + 44*cos(t).*sin(t) + 29*sin(t).^2);
fplot(tm, [0 pi])
grid on
title('tm(t) from 0 to \pi')
xlabel('t');
ylabel('tm');

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by