Help with basic MATLAB syntax

[EDIT: Jun. 14, 17:42:47 UTC - Reformat MKF]
how i write this in matlab
sin(cos(eln25))+100(55/7-1000tan(.23))

댓글 수: 2

Walter Roberson
Walter Roberson 2011년 6월 14일
What does eln25 mean?
Is the 0.23 intended to be degrees or radians?
Walter Roberson
Walter Roberson 2011년 6월 14일
55/7 is an approximation of 2*pi . That suggests to me that perhaps your tan expression is intended to be an arctan expression ?

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

 채택된 답변

Matt Fig
Matt Fig 2011년 6월 14일

0 개 추천

sin(cos(eln25))+100*(55/7-1000*tan(.23))
Assuming eln25 is a variable with numerical value, or a function which returns a number.

댓글 수: 5

Sean de Wolski
Sean de Wolski 2011년 6월 14일
I would guess he mean exp(1)*log(25)
Walter Roberson
Walter Roberson 2011년 6월 14일
I'm thinking zizo might mean exp(log(25)). Hard to say.
Sean de Wolski
Sean de Wolski 2011년 6월 14일
@Walter: wouldn't that just be 25?
Walter Roberson
Walter Roberson 2011년 6월 14일
Sure, but the challenge might be to learn how to code it anyhow. After all the entire expression is constant and could be replaced by a single number.
Sean de Wolski
Sean de Wolski 2011년 6월 14일
Very true. I'll get back to doodling :)

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

추가 답변 (2개)

Matt Tearle
Matt Tearle 2011년 6월 14일

3 개 추천

Just for Sean:
function doodle
hf = figure;
ha = axes('units','normalized','position',[0,0,1,1],...
'XLim',[0,1],'XTick',[],'YLim',[0,1],'YTick',[]);
set(hf,'WindowButtonDownFcn',@startdraw)
uiwait(hf)
function startdraw(src,~)
set(src,'pointer','crosshair')
cp = get(ha,'CurrentPoint');
xinit = cp(1,1); yinit = cp(1,2);
hl = line('XData',xinit,'YData',yinit,...
'color','k','linewidth',2);
set(src,'WindowButtonMotionFcn',@movedraw)
set(src,'WindowButtonUpFcn',@enddraw)
function movedraw(~,~)
cp = get(ha,'CurrentPoint');
xdat = [get(hl,'XData'),cp(1,1)];
ydat = [get(hl,'YData'),cp(1,2)];
set(hl,'XData',xdat,'YData',ydat);
drawnow
end
function enddraw(src,~)
set(src,'Pointer','arrow')
set(src,'WindowButtonMotionFcn',[])
set(src,'WindowButtonUpFcn',[])
uiresume(hf)
end
end
end
Sean de Wolski
Sean de Wolski 2011년 6월 14일

0 개 추천

  1. Open the editor and a new blank file or the command line
  2. Copy the above into it
That will have then been written in MATLAB!

카테고리

질문:

2011년 6월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by