Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations JAE on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting Matlab code to work in Mathcad

Status
Not open for further replies.

bgtman9

Mechanical
Joined
Jul 30, 2009
Messages
7
Location
US
I just cannot seem to write a mathcad program that is the same as a matlab program i wrote awhile back. The short script in MatLab is as follows:

G(1) = 0;

a_counter = .0000001;

H = F;

T(1) = 0;
T(2) = 0;

for j = 2:1:101

F(j) = F(j)-H(j-1);

T(j) = (2*F(j)/Hinc)-a_counter;

if T(j) > 2*G(j-1)
G(j) = T(j)/2;
else
G(j) = G(j-1)+0.001;
end

a_counter = T(j);
end


Any help would be greatly appreciated!

Thanks,
Tom
 
You could RF this thread and repost in the Mathcad forum, as a start.

> Mathcad, in general is not a programming environment, unlike Matlab. As such, it's usually not possible to get the same form.

> Mathcad generally uses indexed variables directly, so FOR loops are often unnecessary.

TTFN

FAQ731-376
 
Yes, it will not because I didnt give the whole code, just the for loop i wanted to create. Thanks for your help though, I think I have figured it out.

Thanks,
Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top