You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
Good day, i designed a model whereby if the speed of the drive profile is less than zero,the output should be one.
1 view (last 30 days)
Show older comments
if i should run this model the workspace data does not correpond with the time step of the drive profile. i want at every time step of the simulation i should get the corresponding speed as the drive profile.
Answers (1)
madhan ravi
on 8 Jan 2024
If you have the drive cycle as a .mat file, use a From File block.
8 Comments
richard uwagbale
on 8 Jan 2024
Thank you for your response, the drive profile data was created in matlab, then imported to simulink using 1-d look up table,whereby the break breakpoonts values are the time in seconds and table data is speed.
madhan ravi
on 9 Jan 2024
Edited: madhan ravi
on 9 Jan 2024
Still , make the drive cycle as timeseries and import it to Simulink using From Workspace block. Ofcourse, drivecycle has to be loaded into MATLAB Base Workspace.
richard uwagbale
on 9 Jan 2024
Thank you but the problem still persist, i did as you suggested created a timeseries of the drive profile, then import to simulink, i also created to workspace to see the speed at each time step, i noticed after 129sec the speed turns to zero untill the end of the simulation.
madhan ravi
on 9 Jan 2024
Edited: madhan ravi
on 9 Jan 2024
Attach your data as .mat file here(including the speed)
madhan ravi
on 9 Jan 2024
>> drivecycle = timeseries(randi([-1, 1], 150*2 + 1, 1), (0: 0.5 : 150).')
timeseries
Common Properties:
Name: 'unnamed'
Time: [301x1 double]
TimeInfo: [1x1 tsdata.timemetadata]
Data: [301x1 double]
DataInfo: [1x1 tsdata.datametadata]
More properties, Methods
>>[drivecycle.Time, drivecycle.Data] % for visualisation
ans =
0 -1.0000
0.5000 0
1.0000 1.0000
1.5000 0
2.0000 0
2.5000 1.0000
3.0000 1.0000
3.5000 0
4.0000 -1.0000
4.5000 -1.0000
5.0000 0
5.5000 0
6.0000 1.0000
6.5000 1.0000
7.0000 0
7.5000 0
8.0000 -1.0000
8.5000 1.0000
9.0000 0
9.5000 -1.0000
10.0000 1.0000
10.5000 0
11.0000 -1.0000
11.5000 1.0000
12.0000 -1.0000
12.5000 -1.0000
13.0000 -1.0000
13.5000 -1.0000
14.0000 -1.0000
14.5000 0
15.0000 -1.0000
15.5000 -1.0000
16.0000 -1.0000
16.5000 1.0000
17.0000 0
17.5000 1.0000
18.0000 0
18.5000 1.0000
19.0000 -1.0000
19.5000 1.0000
20.0000 1.0000
20.5000 -1.0000
21.0000 0
21.5000 -1.0000
22.0000 0
22.5000 -1.0000
23.0000 0
23.5000 0
24.0000 0
24.5000 0
25.0000 -1.0000
25.5000 0
26.0000 0
26.5000 -1.0000
27.0000 0
27.5000 0
28.0000 0
28.5000 1.0000
29.0000 1.0000
29.5000 1.0000
30.0000 -1.0000
30.5000 -1.0000
31.0000 0
31.5000 1.0000
32.0000 1.0000
32.5000 0
33.0000 0
33.5000 -1.0000
34.0000 1.0000
34.5000 0
35.0000 -1.0000
35.5000 0
36.0000 -1.0000
36.5000 1.0000
37.0000 0
37.5000 1.0000
38.0000 -1.0000
38.5000 1.0000
39.0000 0
39.5000 0
40.0000 0
40.5000 1.0000
41.0000 -1.0000
41.5000 1.0000
42.0000 -1.0000
42.5000 -1.0000
43.0000 -1.0000
43.5000 1.0000
44.0000 -1.0000
44.5000 0
45.0000 0
45.5000 0
46.0000 1.0000
46.5000 -1.0000
47.0000 1.0000
47.5000 0
48.0000 1.0000
48.5000 -1.0000
49.0000 0
49.5000 1.0000
50.0000 1.0000
50.5000 0
51.0000 -1.0000
51.5000 -1.0000
52.0000 0
52.5000 1.0000
53.0000 1.0000
53.5000 0
54.0000 1.0000
54.5000 0
55.0000 1.0000
55.5000 -1.0000
56.0000 -1.0000
56.5000 1.0000
57.0000 1.0000
57.5000 1.0000
58.0000 -1.0000
58.5000 -1.0000
59.0000 1.0000
59.5000 1.0000
60.0000 -1.0000
60.5000 -1.0000
61.0000 -1.0000
61.5000 1.0000
62.0000 1.0000
62.5000 0
63.0000 0
63.5000 -1.0000
64.0000 1.0000
64.5000 1.0000
65.0000 0
65.5000 0
66.0000 0
66.5000 -1.0000
67.0000 1.0000
67.5000 1.0000
68.0000 1.0000
68.5000 1.0000
69.0000 -1.0000
69.5000 1.0000
70.0000 -1.0000
70.5000 -1.0000
71.0000 -1.0000
71.5000 -1.0000
72.0000 0
72.5000 -1.0000
73.0000 1.0000
73.5000 1.0000
74.0000 1.0000
74.5000 0
75.0000 0
75.5000 1.0000
76.0000 0
76.5000 -1.0000
77.0000 1.0000
77.5000 -1.0000
78.0000 -1.0000
78.5000 1.0000
79.0000 0
79.5000 -1.0000
80.0000 -1.0000
80.5000 1.0000
81.0000 -1.0000
81.5000 -1.0000
82.0000 1.0000
82.5000 0
83.0000 0
83.5000 0
84.0000 1.0000
84.5000 -1.0000
85.0000 0
85.5000 -1.0000
86.0000 1.0000
86.5000 0
87.0000 1.0000
87.5000 -1.0000
88.0000 0
88.5000 1.0000
89.0000 -1.0000
89.5000 -1.0000
90.0000 -1.0000
90.5000 1.0000
91.0000 0
91.5000 -1.0000
92.0000 1.0000
92.5000 0
93.0000 -1.0000
93.5000 -1.0000
94.0000 -1.0000
94.5000 1.0000
95.0000 -1.0000
95.5000 -1.0000
96.0000 -1.0000
96.5000 -1.0000
97.0000 1.0000
97.5000 1.0000
98.0000 1.0000
98.5000 0
99.0000 0
99.5000 -1.0000
100.0000 0
100.5000 -1.0000
101.0000 -1.0000
101.5000 -1.0000
102.0000 1.0000
102.5000 1.0000
103.0000 -1.0000
103.5000 0
104.0000 0
104.5000 -1.0000
105.0000 1.0000
105.5000 0
106.0000 0
106.5000 -1.0000
107.0000 1.0000
107.5000 1.0000
108.0000 1.0000
108.5000 0
109.0000 1.0000
109.5000 -1.0000
110.0000 0
110.5000 1.0000
111.0000 -1.0000
111.5000 -1.0000
112.0000 1.0000
112.5000 -1.0000
113.0000 -1.0000
113.5000 0
114.0000 -1.0000
114.5000 0
115.0000 1.0000
115.5000 0
116.0000 0
116.5000 1.0000
117.0000 -1.0000
117.5000 0
118.0000 -1.0000
118.5000 0
119.0000 1.0000
119.5000 1.0000
120.0000 0
120.5000 -1.0000
121.0000 0
121.5000 1.0000
122.0000 0
122.5000 1.0000
123.0000 -1.0000
123.5000 -1.0000
124.0000 -1.0000
124.5000 0
125.0000 0
125.5000 -1.0000
126.0000 1.0000
126.5000 -1.0000
127.0000 0
127.5000 -1.0000
128.0000 -1.0000
128.5000 -1.0000
129.0000 0
129.5000 -1.0000
130.0000 -1.0000
130.5000 -1.0000
131.0000 -1.0000
131.5000 0
132.0000 1.0000
132.5000 -1.0000
133.0000 1.0000
133.5000 -1.0000
134.0000 1.0000
134.5000 1.0000
135.0000 1.0000
135.5000 -1.0000
136.0000 0
136.5000 0
137.0000 -1.0000
137.5000 0
138.0000 0
138.5000 -1.0000
139.0000 0
139.5000 1.0000
140.0000 0
140.5000 1.0000
141.0000 0
141.5000 -1.0000
142.0000 -1.0000
142.5000 1.0000
143.0000 0
143.5000 -1.0000
144.0000 0
144.5000 0
145.0000 1.0000
145.5000 0
146.0000 1.0000
146.5000 1.0000
147.0000 -1.0000
147.5000 -1.0000
148.0000 1.0000
148.5000 0
149.0000 -1.0000
149.5000 1.0000
150.0000 0
>> save("richard.mat", "drivecycle")
madhan ravi
on 9 Jan 2024
See Also
Categories
Find more on Sources in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)