while running an optimatization algo, m geting this error"matrix must be square"

2 views (last 30 days)
the func tht is to be executed:
function [ E ] = Iden_4( a )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
w=0:0.01:pi;
f=w/pi;
a1=[1 -0.9 0.81 -0.729]
a2=[1 0.04 0.2775 -0.2101 0.14]
d=freqz(a1,a2,w);
a3=[a(1) a(2) a(3) a(4)]
a4=[1 a(5) a(6) a(7) a(8)]
y=freqz(a3,a4,w);
E=sum((abs(y)-abs(d))^2)
  2 Comments
Alan Weiss
Alan Weiss on 20 Jan 2016
Edited: Alan Weiss on 20 Jan 2016
Please mark your code with the {} Code button to help us read it more easily.
Alan Weiss
MATLAB mathematical toolbox documentation
Matt J
Matt J on 20 Jan 2016
Edited: Matt J on 20 Jan 2016
In future (see also Alan's remark), please font your code distinctly from your text using the {} Code toolbar button, as I have done for you now.
Regardless, you've omitted from your post how you are performing the optimization. You've also omitted the exact error message, which would reveal the line of code that generates it.

Sign in to comment.

Answers (0)

Categories

Find more on Problem-Based Optimization Setup in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!