필터 지우기
필터 지우기

Error using * ?

조회 수: 1 (최근 30일)
reza hamzeh
reza hamzeh 2019년 12월 14일
댓글: Walter Roberson 2019년 12월 14일
hi. i wrote these codes. but it gives me error. plz help me. how can i fix this error?
error.jpg
if handles.plot2.Value==1
var1=get(handles.varible1,'string');
range1=str2num(get(handles.range1,'string'));
H=str2num(get(handles.hamiltonian,'string'));
if handles.thermal.Value==1
sx=[0 1;1 0];
sy=[0 -1i;1i 0];
sz=[1 0;0 -1];
s=kron(sy,sy);
ro = expm(-H/T)/trace(expm(-H/T));
la = real(sqrt(eig(ro*s*conj(ro)*s)));
co=@(var1) max(0,2*max(la)-sum(la));
var1=range1;
for k = 1:numel(range1)
cov(k) = co(range1(k));
end
axes(handles.axes1);
plot(range1, cov)
end
end
%the error is
%matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)quantum('temperature_CreateFcn',hObject,eventdata,guidata(hObject))
%Error using *
%Inner matrix dimensions must agree.
%Error in quantum>run_Callback (line 225)
% la = real(sqrt(eig(ro*s*conj(ro)*s)));
%Error in gui_mainfcn (line 95)
% feval(varargin{:});
%Error in quantum (line 42)
% gui_mainfcn(gui_State, varargin{:});
%Error in
%matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)quantum('run_Callback',hObject,eventdata,guidata(hObject))
%Error while evaluating UIControl Callback.
  댓글 수: 2
Star Strider
Star Strider 2019년 12월 14일
The error is clear menough:
Error using *
Inner matrix dimensions must agree.
Error in quantum>run_Callback (line 225)
la = real(sqrt(eig(ro*s*conj(ro)*s)));
Examine the sizes of the components of that expression to see what the problem is.
Walter Roberson
Walter Roberson 2019년 12월 14일
Two many variables we do not know the size of.
Also, we have no reason to expect that the variable J will have a value at that point, so the str2num() is likely to return []

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by