Unrecognized function or variable 'x'.

4 ビュー (過去 30 日間)
Soumya
Soumya 2024 年 3 月 27 日
コメント済み: Yash 2024 年 3 月 27 日
Hi, i am running the mass spring damper system using simulink with a live mscript. but in case of displacement , what should i define?? It provides an errpr as "Unrecognized function or variable 'x'." in live msript. i have put the two screenshots as pictures . kindly solve it. i will be very thankful for.
  1 件のコメント
Yash
Yash 2024 年 3 月 27 日
"x" and "y" are not defined in the code. Since you have used "To Workspace" block in simulink, your variables are saved in the variable "out". Here is an example of what you can do to get those values:
out = sim('Mass_Spring_System2_simulink.slx');
displacement = out.x.Data;
timeArr = out.x.Time;
plot(timeArr, displacement);

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

回答 (1 件)

Lokesh
Lokesh 2024 年 3 月 27 日
Hi Soumya,
Based on my understanding, you are encountering an error stating "Unrecognized function or variable 'x'" while running a Live Script.
From the attached screenshot, it appears that you are attempting to use plot(x) without having defined the variable 'x'. Similarly, you haven't defined the variable 'y', which is used in plot(y). Please replace 'x' and 'y' with the variables you intend to plot.
Refer to the following MATLAB documentation to know more about 'plot':

カテゴリ

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

タグ

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by