Asked by melon
on 12 Jan 2013

function [P]=BULBP(x,n) P=zeros(n); for i=1:n P(n)=P(n)+x(i)*Psat(i);

end

end end

*No products are associated with this question.*

Answer by Azzi Abdelmalek
on 12 Jan 2013

What is Psat? Why are using 3 end?

function P=BULBP(x,n) P=zeros(1,n); for ii=1:n P(n)=P(n)+x(ii)*Psat(ii); % what is Psat? end

Answer by Walter Roberson
on 12 Jan 2013

The code would give an error if n was negative or contained a fraction or an imaginary number.

Also note that if n is a scalar, then

zeros(n)

is the same as

zeros(n,n)

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply Today
## 1 Comment

## Jan Simon (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/58635#comment_122228

Which error message do you get? Reading and considering them is a good idea in Matlab.