how can i have step input signal in signal editor?

조회 수: 9 (최근 30일)
elham
elham 2024년 9월 1일
댓글: Umar 2024년 9월 10일
I have 3 signals for a SCARA robot. I want to input a step input for these 3 signals in the Signal Editor. How should I enter the time and data inputs in the Signal Editor?
x=[1.412,0.8696,1.412,1.412,1.821,1.545,1.8312.382,1.412]
y=[-3.142,-2.088,-3.142.-3.142,-3.142,-2.31,-3.142,-3.142,-3.142]
z=[-0.086,-0.086,-0.086,-0.186,-0.186,-0.186,-0.186,-0.386,-0.086]
t=[0,1,1.5,2,3,4,4.5,5,6]
  댓글 수: 1
Umar
Umar 2024년 9월 1일
편집: Umar 2024년 9월 1일

Hi @elham,

You asked, “ How should I enter the time and data inputs in the Signal Editor?

Please see my response to your comments below.

You have three signals (x, y, z) that represent positions or movements of the SCARA robot, and you want to configure these signals in the Signal Editor with respect to specific time intervals. You also provided the time data, indicating how these signals change over time. Using the information you've given, access the Signal Editor via the command line by typing signalEditor or through the Root Inport Mapper by selecting Signals > New MAT-File. Select Insert > Signal to create a new signal. You will need to repeat this process for each of your signals (x, y, z). For each signal, you will need to enter the time (t) and the corresponding data values ( x, y, z). Here’s how to do it:

For Signal x, in the Author Signal dialog box, set:
Time: [0, 1, 1.5, 2, 3, 4, 4.5, 5, 6]
Data: [1.412, 0.8696, 1.412, 1.412, 1.821, 1.545, 1.8312, 2.382,     1.412]
For Signal y, Set:
Time: [0, 1, 1.5, 2, 3, 4, 4.5, 5, 6]
Data:[-3.142, -2.088, -3.142, -3.142, -3.142, -2.31, -3.142, -3.142, 
-3.142]
For Signal z,Set:
Time: [0, 1, 1.5, 2, 3, 4, 4.5, 5, 6]
Data: [-0.086, -0.086, -0.086, -0.186, -0.186, -0.186, -0.186, 
-0.386, -0.086]

After entering the data, you can modify properties such as the signal name, unit, and interpolation method. This can be done in the Signal Properties section. Once the signals are entered, you can visualize them on the plot. If the signals do not align as expected, you can adjust them using the Snap to Grid feature for better precision.

To save your work, select the Save button in the Signal Editor. This will create a MAT-file that can be used for simulations or linked to root-level ports.

For more information regarding creating and editing a signal, please refer to the following documentation at the link provided below.

https://www.mathworks.com/help/simulink/ug/insert-and-edit-signal-data.html

Hope this helps. Please let me know if you have any further questions.

댓글을 달려면 로그인하십시오.

답변 (2개)

Shivam
Shivam 2024년 9월 1일
편집: Shivam 2024년 9월 1일
Hi Elham,
I understand that you have 3 step signal inputs which you want to plot in the signal editor.
You can follow the following steps to input the step signals for your robot:
1. Open Signal Editor by typing the following command in the command line of MATLAB:
>> signalEditor
2. Define your signals programatically by running the following MATLAB script:
% Define the time vector
t = [0, 1, 1.5, 2, 3, 4, 4.5, 5, 6];
% Define the data vectors
x = [1.412, 0.8696, 1.412, 1.412, 1.821, 1.545, 1.831, 2.382, 1.412];
y = [-3.142, -2.088, -3.142, -3.142, -3.142, -2.31, -3.142, -3.142, -3.142];
z = [-0.086, -0.086, -0.086, -0.186, -0.186, -0.186, -0.186, -0.386, -0.086];
% Create a timetable for each signal
x_signal = timetable(seconds(t)', x');
y_signal = timetable(seconds(t)', y');
z_signal = timetable(seconds(t)', z');
3. To import the signals, open the Signal Editor and choose the Import option. A window will appear where you can select the signals. Proceed by selecting the following signals: x_signal, y_signal, z_signal, and t.
Here is the output from the Signal Editor, displaying the configured step inputs for the SCARA robot signals.
I hope it helps.
Thanks
  댓글 수: 5
Shivam
Shivam 2024년 9월 2일
편집: Shivam 2024년 9월 2일
Hi Elham,
There needs to be a criteria to convert x,y and z into corresponding arrays of step values and this criteria should be unique to your case.
Upon further investigation I found that, the step value changes from 0 to some max value(0.2, 0.4 and 0.3 for x, y and z respectively) when input signal's value decreases for the first time.
For x signal, it happens at t = 0.5 (traced from provided figure since data is provided for t = 0.5). Similarily, for y and z signal, it happens at t = 1.5 and 2 sec respectively.
From the attached image, I have derived these input signals:
t = [0, 0.5, 1, 1.5, 2, 3, 4, 4.5, 5, 6];
% Define the step signals
x = [0, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2]; % Max value 0.2, changes at 0.5 sec
y = [0, 0, 0, 0.4, 0.4, 0.4, 0.4, 0.4, 0.4]; % Max value 0.4, changes at 1.5 sec
z = [0, 0, 0, 0, 0.3, 0.3, 0.3, 0.3, 0.3]; % Max value 0.3, changes at 2 sec
Then, you can insert Step waveform which asks to input data corresponding to time.
Please refer to the attached image to look into step signal corresponding to x signal.
Sam Chak
Sam Chak 2024년 9월 2일
However, the actual input data requested by @elham are not utilized in the code to produce the desired step outputs for the SCARA robot. The code should not rely on manually defined specific points to "trick" the robot. Instead, a step function that is dependent on the input data should be designed.
% Time vector
t = [0, 1, 1.5, 2, 3, 4, 4.5, 5, 6];
% Data
x = [ 1.412, 0.8696, 1.412, 1.412, 1.821, 1.545, 1.831, 2.382, 1.412];
y = [-3.142, -2.088, -3.142, -3.142, -3.142, -2.31, -3.142, -3.142, -3.142];
z = [-0.086, -0.086, -0.086, -0.186, -0.186, -0.186, -0.186, -0.386, -0.086];
% Plot
figure
subplot(311)
plot(t, x, 'o--'), grid on
title('input x data')
subplot(312)
plot(t, y, 'o--'), grid on
title('input y data')
subplot(313)
plot(t, z, 'o--'), grid on
title('input z data'), xlabel('t')

댓글을 달려면 로그인하십시오.


Umar
Umar 2024년 9월 2일

Hi @elham,

To achieve a step input configuration, you need to make that the data values remain constant until the next specified time point. For instance:

For signal x, if you want it to rise at t = 1 and stay constant, the structure should look like: From (t = 0 ) to (t = 1 ), Constant value (e.g., 1.412). At (t = 1) Jump to a new constant value (e.g., 1.821). From here on, continue at the new value for the remaining duration.

Here’s how to arrange the data for each signal:

Rearranging Data for Step Inputs

   Signal x
   Time: [0, 1, 2, 3, 4, 5, 6]
    Data: [1.412, 1.412, 1.821, 1.821, 1.8312, 2.382, 1.412]
   Signal 
   Time: [0, 1, 2, 3, 4, 5, 6]
    Data: [-3.142, -3.142, -2.31, -2.31, -2.31, -3.142, -3.142]
   Signal z
   Time: [0, 1, 2, 3, 4, 5, 6]
    Data: [-0.086, -0.086, -0.186, -0.186, -0.186, -0.386, -0.086]

Entering Data in Signal Editor

At this point, I know that you are already familiar with Signal Editor but I will provide instructions anyway like I did in my previous comments as outlined below.

Open Signal Editor via the command line by typing signalEditor or select Signals > New MAT-File through the Root Inport Mapper.

For each signal (x, y, z) Select Insert > Signal

In the Author Signal dialog box, enter the rearranged time and data values as outlined above. Modify properties like the signal name, unit, and interpolation method in the Signal Properties section.

Visualizing the Step Inputs

After entering all signals, visualize them on the plot within the Signal Editor. If necessary, use the Snap to Grid feature to fine-tune the data points for better alignment.

Saving the Configuration

Once satisfied with the setup, click the Save button to create a MAT-file for further simulations or linking to root-level ports.

Please make sure that you select the appropriate interpolation method (e.g., "Zero-Order Hold") for step inputs to maintain the desired constant value between the defined time intervals.

In case, you need more guidance or you need detailed steps on signal creation and editing, I will consider reviewing the official MathWorks documentation:

https://www.mathworks.com/help/simulink/ug/insert-and-edit-signal-data.html

Hope, at this point you should be able to configure the SCARA robot signals effectively in the Signal Editor and represent them as step inputs as required. Please let me know if this helped resolve your problem.

  댓글 수: 25
Sam Chak
Sam Chak 2024년 9월 9일
This issue pertains not to robotics, but to the pure mathematics of mass-spring-damper that describes the desired response signal, which is typically covered in degree-level S.T.E.M. courses. You should provide the Simulink file that was requested earlier so that we can have a closure on this thread.
Please click the paperclip icon .
Umar
Umar 2024년 9월 10일
Hi @elham,
Please don’t take our comments as negative. I can assure you that @Sam Chak is very knowledgeable and kind person. He does help lot of OPs in the past by tackling complex problems and helped found solutions for them. We are here to help you. I don’t even have access to Simulink or Robotics toolbox, but still trying my best to help you find the solution, so you can achieve your desired goal.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 View Data During Simulation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by