how to obtain this waveform

1 次查看(过去 30 天)
Hey guys do you know anyway of obtaining this waveform using matlab or simulink? It is the boldfaced one.

采纳的回答

Image Analyst
Image Analyst 2014-12-13
How about this:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
t1 = 0.0005;
t2 = .008;
t3 = .0087;
t4 = 0.0161;
t = linspace(0, .018, 300);
period1 = (t2-t1) * 2;
period2 = (t4-t3) * 2;
ipv1 = sin(2 * pi * (t - t1) / period1);
subplot(3, 1, 1);
plot(t, ipv1, 'b-', 'LineWidth', 2);
grid on;
ipv2 = sin(2 * pi * (t - t4) / period2);
subplot(3, 1, 2);
plot(t, ipv2, 'b-', 'LineWidth', 2);
grid on;
% Make output array
ipv = zeros(1, length(t));
% Assign hump from curve 1 to it.
indexRange1 = ipv1 >= 0 & t >= t1 & t <= t2;
ipv(indexRange1) = ipv1(indexRange1);
% Assign hump from curve 2 to it.
indexRange2 = ipv2 <= 0 & t >= t3 & t <= t4;
ipv(indexRange2) = ipv2(indexRange2);
subplot(3, 1, 3);
plot(t, ipv, 'b-', 'LineWidth', 2);
grid on;
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 View and Analyze Simulation Results 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by