×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Converting Matlab code to work in Mathcad

Converting Matlab code to work in Mathcad

Converting Matlab code to work in Mathcad

(OP)
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

RE: Converting Matlab code to work in Mathcad

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: Eng-Tips.com Forum Policies

RE: Converting Matlab code to work in Mathcad

and it doens't run in matlab anyway.

Cheers

Greg Locock

SIG:Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.

RE: Converting Matlab code to work in Mathcad

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources