Conversion of Mathematica code to matlab

조회 수: 2 (최근 30일)
Mikhos
Mikhos 2013년 3월 4일
답변: ABHIJAY PANDEY 2016년 9월 6일
I have the following code in mathematical and need to convert it into matlab but cant for the life of me understand ow to do it, though i think i need to use the 'fzero'; command. Please could someone help me or give me a hint?
function 'f' has already been defined but i need to find its roots for where variable a is from 0-0.6 etc
list1=For[a=-0.01, a<0.6, a+=0.01; sol=Findroot[f,{u, 1.00,1.10}];
v1[i] = sol[[1,2]]; i++]
  댓글 수: 2
Walter Roberson
Walter Roberson 2013년 3월 4일
Is f defined in terms of "a" ?
Mikhos
Mikhos 2013년 3월 4일
yeh it is

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

답변 (2개)

Walter Roberson
Walter Roberson 2013년 3월 4일
vl = arrayfun(@(a) fzero( @(x) f(x,a), [1 1.1] ), -0.01 : 0.01 : 0.6-eps);
the "-eps" is to recreate the "<" part of "<0.6". Using 0.5 instead might work.
  댓글 수: 12
Walter Roberson
Walter Roberson 2013년 3월 12일
Why did you remove the ",v" in the argument lists?
Mikhos
Mikhos 2013년 3월 13일
because i copied them from a previous file. In that file i was plotting w with respect to a for five specific values of v so I treated it like a constant

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


ABHIJAY PANDEY
ABHIJAY PANDEY 2016년 9월 6일
f[x_]=0.09*sin[x]+0.085*sin[x-1] plot[f[x],{x,-2,2}] can anybody please tell me the matlab code for this mathematica code.

카테고리

Help CenterFile Exchange에서 Software Development Tools에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by