Why do I receive legend error in matlab

2 ビュー (過去 30 日間)
Kamar Ledgister
Kamar Ledgister 2020 年 9 月 6 日
コメント済み: Star Strider 2020 年 9 月 6 日
close all;
clear all;
clc
m=10;
b=5;
k=100;
F=100;
timerange=[0 20];
initialvalues=[0 0];
[t, x]=ode45(@second_order1,timerange,initialvalues);
figure
plot(t,x(:,1),'LineWidth',2)
ylabel('position(m),velocity(m/s),acceleration(m/s^2)')
xlabel('time(s)')
hold on
plot(t,x(:,2),'LineWidth',2,'LineStyle','-.')
hold on
plot(t,F/m-(b/m)*x(:,2)-(k/m)*x(:,1),'LineWidth',2,'LineStyle',':')
legend ('Position','Velocity','Acceleration')

回答 (1 件)

Star Strider
Star Strider 2020 年 9 月 6 日
I cannot run yuour code, since I get:
Unrecognized function or variable 'second_order1'.
What is the error you are seeing?
  5 件のコメント
Kamar Ledgister
Kamar Ledgister 2020 年 9 月 6 日
Thank you
Star Strider
Star Strider 2020 年 9 月 6 日
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLegend についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by