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 4274410
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:50:35+00:00 2026-05-21T07:50:35+00:00

I want to write a command to display equation of robot position and its

  • 0

I want to write a command to display equation of robot position and its graph. This is my command, but it did not display the graph:

clear;
clc;

% initial position
theta1s=-150;
theta2s=-80;
theta3s=-50;
theta4s=-100;
theta5s=-180;

% final position
theta1f=20;
theta2f=100;
theta3f=80;
theta4f=50;
theta5f=180;

% time taken for movement
tf=input('time=')

% acceleration for every link
acc1=(4.*(20-(-150)))./(tf^2)
acc2=(4.*(100-(-80)))./(tf^2)
acc3=(4.*(80-(-50)))./(tf^2)
acc4=(4.*(50-(-100)))./(tf^2)
acc5=(4.*(180-(-180)))./(tf^2)

% blending time for every link
tb1=((0.5.*(tf))-(0.5.*(sqrt((((tf^2).*acc1)-(4.*(20-(-150))))./acc1))))
t = 0;
for x = 0:tf;
    t = t + 0.1;
    if 0<t<=tb1;
        y = theta1s+((0.5.*acc1).*(t^2));
    elseif tb1<t<=tf-tb1;
        y = (theta1s-((0.5.*acc1).*(tb1^2)))+(acc1.*tb1.*t);
    else tf-tb1<t<=tf;
        y = theta1s-((0.5.*acc1).*(tf.*t)^2);
    end

    plot(x,y,'r')
    title('Position Versus Time');
    xlabel('time in s');
    ylabel('position in m');
    grid on;
    drawnow;  
end

disp(y);
  • 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-21T07:50:36+00:00Added an answer on May 21, 2026 at 7:50 am

    You can replace plot(x,y,’r’) by plot(x,y,’r*’). So, you will be able to see sepparate points.
    Also you will need to add “hold on” after plot function to be able to overlay plots for all iterations.

    If you want to draw line but not sepparate points, you should better move the visualization out of the loop. Here is the modified code:

    clear;
    clc;
    
    % initial position
    theta1s=-150;
    theta2s=-80;
    theta3s=-50;
    theta4s=-100;
    theta5s=-180;
    
    % final position
    theta1f=20;
    theta2f=100;
    theta3f=80;
    theta4f=50;
    theta5f=180;
    
    % time taken for movement
    tf=input('time=')
    
    % acceleration for every link
    acc1=(4.*(20-(-150)))./(tf^2)
    acc2=(4.*(100-(-80)))./(tf^2)
    acc3=(4.*(80-(-50)))./(tf^2)
    acc4=(4.*(50-(-100)))./(tf^2)
    acc5=(4.*(180-(-180)))./(tf^2)
    
    % blending time for every link
    tb1=((0.5.*(tf))-(0.5.*(sqrt((((tf^2).*acc1)-(4.*(20-(-150))))./acc1))))
    t = 0;
    
    % allocate memory for array
    y = zeros(1, tf+1);
    
    for x = 0:tf;
        t = t + 0.1;
        if 0<t<=tb1;
            y(x+1) = theta1s+((0.5.*acc1).*(t^2));
        elseif tb1<t<=tf-tb1;
            y(x+1) = (theta1s-((0.5.*acc1).*(tb1^2)))+(acc1.*tb1.*t);
        else tf-tb1<t<=tf;
            y(x+1) = theta1s-((0.5.*acc1).*(tf.*t)^2);
        end
    end
    
    plot(0:tf,y,'r')
    title('Position Versus Time');
    xlabel('time in s');
    ylabel('position in m');
    grid on;
    drawnow;
    
    disp(y);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a command but I do not want one long
I want to use MPI (MPICH2) on windows. I write this command: MPI_Barrier(MPI_COMM_WORLD); And
I am working on a project with serial port. I want to Write command
I want to write a command line program to add a contact to GoogleMail.
I want to write an apps that accepts user command. The user command is
I want to write a unit test for a Django manage.py command that does
I want to write a syntax highlighting extension for Emacs, but I Googling of
I want to write a command line utility that can be used to synchronize
i want to write to a file by cat command. cat $variable >t.h while
I want to write client-server using SSL with eclipse. I generate key using this

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.