how to vectorize this "For Loop" ?
이전 댓글 표시
close all
clear all
clc
tic;
for k=1:0.5:10;
for a=1:0.5:5;
num=k;
den=[1 a 0];
sys=tf(num,den);
bode(sys);grid on;hold on;
end
end
time=toc
채택된 답변
추가 답변 (1개)
scadaprog
2017년 7월 16일
Hi, This is one way of doing it:
k=1:.5:10; a=1:.5:5;
num=repmat(k',numel(a),1);
a = [ones(numel(a),1) a' zeros(numel(a),1)];
den = repmat(a, numel(k),1);
sys = tf(num2cell(num),num2cell(den,2));
bode(sys);
카테고리
도움말 센터 및 File Exchange에서 Time and Frequency Domain Analysis에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!