Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3974382
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:33:41+00:00 2026-05-20T04:33:41+00:00

I am trying to make a program which maps coordinates. I am having trouble

  • 0

I am trying to make a program which maps coordinates. I am having trouble getting Matlab to select specific values based on the vector inequality. Maybe I am doing it wrong but here is my code, where g is a vector giving the global locations of the points. EL is the length of “objects” and the local coordinates are the coordinates of the points on the “objects” for a 1-D case. Then those local coordinates are reevaluated to give a value of -1 to 1 across the length of the global object. PL is the location of the objects globally.

%Get the local coordinates of the points

for g=(gp(gp>0))
    for n1=(gp(gp<EL(1,1)))
    gp1=[n1, 1];
    end;
    for x=(gp(PL((x1-1),1)<gp<PL((x1),1)));
    gp2=[(x-(EL(x1,1))),1];
    end
    for x=(gp((PL(x1,1)<=gp)));
    gp3=[((x)-(EL(x1,1))),1];
    end
    lpap=([gp1,gp2,gp3]);
    %use the local coordinates to get the natural coordinates
    for x=(gp(gp<=EL(1,1)))
    nc=[((lpap*2)/EL(1,1))-1,1];
    end
    for x=(gp(PL(x1-1,1)<gp<PL(x1,1)));
    nc1=[((lpap*2)/EL(x1,1))-1,1];
    end
    for p=(gp(PL(x1,1)<=gp));
    nc2=[((lpap*2)/EL(x1,1))-1,1];
    end
    nct=[nc,nc1,nc2]

end

Besides nct not being -1 to 1 I know something is wrong because running this gives me one constant value for the x,p, n1 variables, which should give multiple values.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T04:33:42+00:00Added an answer on May 20, 2026 at 4:33 am

    I’m not sure what you’re trying to do here, and I suggest reading MATLAB’s documentation on flow control to get a better idea of how to program in matlab, but just to get you started…

    For loops in matlab work over an array:

    for n = 1:10
        % do stuff
    end
    

    To select parts of an array based on value, you would use index referencing:

    a = [1 2 3 4 5 6 7 8];
    a_gt_four = a(a>4);  % returns [5 6 7 8];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a program in which values increase as a button is
I'm trying to make a program which creates a spaceship and I'm using the
I am trying to make a program in Java that checks for three specific
I'm trying to make a program which listens to the client input stream by
I'm trying to make a program that creates and reads a binary file, which
I am trying to make a program which does a very basic calculation, but
So I have been given a C program, which I am trying to make
I'm trying to make a program (client) which kan send a message to a
I am trying to make a program through which i want to manipulate data
I'm trying to write a program which executes make.exe from MinGW distribution in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.