how to obtain this waveform

조회 수: 2 (최근 30일)
Danilo NASCIMENTO
Danilo NASCIMENTO 2014년 12월 13일
답변: Image Analyst 2014년 12월 13일
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에서 App Building에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by