필터 지우기
필터 지우기

Here simple code keeps freezing my matlab, guess why?

조회 수: 1 (최근 30일)
Joon Jeon
Joon Jeon 2012년 3월 20일
Hi, the following code keeps my matlab freezed(busy). And it never get solved!
y=[9048;4807;3393;2686;2262;1980;1778;1626;1508];
z=[22187;11787;8321;6587;5547;4854;4359;3988;3699];
beta=0.985^2;
alpha=0.3;
gamma=0.03;
phi=roundn([2.077869902373392 2.560745705954086], -3);
R=3026;
syms x;
eval=zeros(2,9);
for i=1:9
[eval(:,i)]=solve(gamma/(R-(1+phi(1)*x)*(1+phi(2)))-z(i)-((1+alpha*beta)/beta*(gamma/x-y(i))), x);
end
Saying code is not that correct in Loop.
But, even after removing loop and plugging just y(1) and z(1) doesn't work.
Do you know the reason? Is it memory problem? or any suggestion, please?
  댓글 수: 1
Alexander
Alexander 2012년 3월 20일
Which version of MATLAB are you using? My MATLAB returns the following result after less than one second:
eval =
408.4511 408.4511 408.4511 408.4511 408.4511 408.4511 408.4511 408.4511 408.4511
-0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000

댓글을 달려면 로그인하십시오.

채택된 답변

Daniel Shub
Daniel Shub 2012년 3월 20일
It runs just fine for me if I remove the roundn call (as I don't have that function/toolbox/version).
Given your propensity to use builtin functions as variable names (beta, alpha, gamma, and eval), have you overwritten something else that is important (e.g., solve, syms, times).

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by