how create correct function
显示 更早的评论
Hi I wrote something like that and I think it is a function but I got some errors when I run it. What is mistake?
function t = Aineq(k1,q,e,a,b)
m=input('input m=')
n=input('input n=')
q=sparse(m*n,m*n)
e=speye(m*n)
k1=-4*e
a=constraint12b(m,n)
b=constraint12c(m,n)
t=[k1 q e q;q k1 q e;a q e q;q a q e;b q -e q;q b q -e]
end
I point that constraint12b and constraint12c are functions separately and could be ran correctly.
4 个评论
Guillaume
2014-11-28
Rather than leaving it for us to guess, what errors do you get? Please paste the entire error message including the part that shows the line where the error occurs.
fatema saba
2014-11-28
Guillaume
2014-11-28
The code that you posted in your question does not match the error message that you've just posted. Line 2 in your question is:
m=input('input m=')
whereas according to the error, it is:
q=sparse(m*n,m*n)
Obviously, if you remove the line that creates m, then it's not going to be defined.
In the future, please post the exact code you use, otherwise you're sending us on a wild goose chase.
Anyway, Azzi's answer should be what you're looking for.
fatema saba
2014-11-28
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Matched Filter and Ambiguity Function 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
