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.
0 件のコメント
採用された回答
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File 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!