Unrecognized Function or Variable

4 ビュー (過去 30 日間)
Iuliu Toma
Iuliu Toma 2020 年 10 月 27 日
回答済み: Cam Salzberger 2020 年 10 月 27 日
This is strange because I got this to work before with the variable x but when I changed the variable x to x1 it stopped working and has not worked since even changing it back to x. I dont know what I did or how to solve this.
d1 = (25*cosd(30)/9.81*(25*sind(30)+sqrt((25*sind(30))^2+2*9.81*3.5)))
y1 = (x1*tand(30)-(1/2)*9.81*x1.^2/((25*cosd(30))^2))
x1 = linspace(0,d1,200)
plot(x1,y1)

回答 (1 件)

Cam Salzberger
Cam Salzberger 2020 年 10 月 27 日
You are using x1 in your calculation for y1 before you ever define x1. Flip the order of those two lines.
It might have worked before if you are running this as a script (in the base workspace) and you had a previously-existing definition for "x".
-Cam

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by