close all
clear all
clc
tic;
i=1;
for k=1:0.5:10;
for a=1:0.5:5;
numpl(i,:) =k;
denpl(i,:) =[1 a 0];
i=i+1;
end
end
w=[.1,.5,.8,1,2,8,15,50,100];
P=freqcp(numpl,denpl,w);
toc

 채택된 답변

alice
alice 2017년 7월 21일
편집: alice 2017년 7월 21일

0 개 추천

You could do:
n1 = numel(1:0.5:10);
n2 = numel(1:0.5:5);
numpl2 = repelem(1:0.5:10,n2)';
denpl2 = repmat([ones(n2,1),(1:0.5:5)',zeros(n2,1)],n1,1);
ps: you can edit your code with the button '{} Code' when you write a question, in order to make it easier to read.

댓글 수: 3

Anita pawar
Anita pawar 2017년 7월 22일
this solution is not execute in the matlab.I got this error "Undefined function 'repelem' for input arguments of type 'double'.
Error in Untitled11 (line 5) numpl2 = repelem(1:0.5:10,n2)';" while executing this solution
Walter Roberson
Walter Roberson 2017년 7월 22일
Rewritten:
v1 = 1:0.5:10;
v2 = 1:0.5:5;
n1 = numel(v1);
n2 = numel(v2);
numpl2 = repmat(v1, 1, n2)';
denpl2 = repmat([ones(n2,1), v2.', zeros(n2,1)] ,n1, 1);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

제품

질문:

2017년 7월 21일

댓글:

2017년 7월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by