This function does not work and gives the error in P=zeros(n) i don't understand why
1 view (last 30 days)
Show older comments
function [P]=BULBP(x,n)
P=zeros(n);
for i=1:n
P(n)=P(n)+x(i)*Psat(i);
end
end
end
1 Comment
Jan
on 12 Jan 2013
Which error message do you get? Reading and considering them is a good idea in Matlab.
Answers (3)
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
0 Comments
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)
0 Comments
See Also
Categories
Find more on Historical Contests 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!