Clear Filters
Clear Filters

To plot mean signal(mean of multiple signals) in matlab figure?

4 views (last 30 days)
Hi there, i have a mix of 168 signals. i want to plot the single signal( mean of all 168 signals) using matlab figure (through data inspector). How can it be done? or any other way of doing it?
please help!

Accepted Answer

Hassaan
Hassaan on 21 Feb 2024
Edited: Hassaan on 21 Feb 2024
@SUDEEP SINGH RAWAT You are using simulink?. To what I currently understand about your query.
If you are planning to use Simulink Data Inspector and Plot Data [see the below link]:
If you are planning to use MATLAB Workspace and Plot Data:
% Example: Assuming you have a matrix 'signals' of size [168 x N]
% Step 1: Suppose 'signals' is your matrix with 168 signals
% For demonstration, let's create a sample 'signals' matrix
N = 1000; % Number of data points in each signal
signals = rand(168, N) + repmat(linspace(0, 1, N), 168, 1); % Sample data
% Step 2: Compute the mean signal
meanSignal = mean(signals, 1); % Averages across the rows
% Step 3: Plot the mean signal
figure; % Creates a new figure window
plot(meanSignal);
title('Mean of 168 Signals');
xlabel('Time or Data Point Index');
ylabel('Mean Signal Value');
% Optionally, to use Data Inspector, you can send the data to the workspace
assignin('base', 'meanSignal', meanSignal);
-----------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering
Feel free to contact me.

More Answers (0)

Categories

Find more on View and Analyze Simulation Results in Help Center and File Exchange

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!