Error when calling function, "Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters."
이전 댓글 표시
function m_roots(f,m)
xroots = zeros(1,m);
dx=1/100; x=0; jj=0;
while jj<m
while f(x)*f(x+dx)>0, x=x+dx; end
jj=jj+1;
xroots(jj) = fzero(f,x);
x = x+2*dx;
end
posxroots = xroots(xroots>0);
x = linspace(0,m,201);
plot(x,f(x), posxroots, f(xroots),'o');
end
It says the error is on line 16 column 16, which is right aftewr the 'm' in x = linspace(0,m,201)
No clue why its giving me this error. Is there something else wrong with my code?
댓글 수: 2
the cyclist
2019년 9월 24일
Can you give an example of calling that function, that exhibits that error? The things I try either give a different error, or they result in the function just running forever (or at least beyond my patience).
Walter Roberson
2019년 9월 24일
Also, could you attach the .m as an attachment? There might be an odd character in it that did not show up when you pasted.
답변 (3개)
JAIMIN PATEL
2019년 9월 25일
0 개 추천
L1=0.25; L2=0.1; L3=0.15; L4=0.15; k1=1.65; k2=2.81; k3=9.2; k4=10.7; t1=1100; t5=337.5; q=[t1-t5]/[(L1/k1)+(L2/k2)+(L3/k4)+(L4/k4)]; ti=1; for j=2:1:4 for i=j-1 tj=ti-q*(Li/ki) end end disp(tj)
I want to solve this but I don't know how to put values of Li and Ki as L1,L2,L3,L4 and k1,k2,k3,k4?? Help me if any one know
댓글 수: 1
the cyclist
2019년 9월 25일
I assume you intended to ask a new question, rather than write this as an answer on a completely unrelated question.
JAIMIN PATEL
2019년 9월 26일
0 개 추천
ti=1; for j=2:1:4 for i=j-1 tj=ti-q*(Li/ki) end end
How can I call vale of Li and Ki ??
JAIMIN PATEL
2019년 9월 26일
0 개 추천
assume i:1:4 how to take ti=t1,t2,t3,t4 ?? Ans. Fast
댓글 수: 1
Walter Roberson
2019년 9월 26일
You should be starting your own Question for these matters.
카테고리
도움말 센터 및 File Exchange에서 Numeric Solvers에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!