Question

In: Computer Science

Implement the working of a mohr circle in matlab. ask user to enter the stresses in...

Implement the working of a mohr circle in matlab. ask user to enter the stresses in x and y direction. take the inputs to a stress tensor. then use formulations to find the eigen value and vectors.

MATLAB

Solutions

Expert Solution

% Center of Mohr Circle

sigma_x =input('Enter value of stress in x direction in N/mm2: ');

sigma_y = input('Enter value of stress in y direction in N/mm2: ');

sigma_c = (sigma_x+sigma_y)/2;

% Center = (sigma_c,0)

shear_t = input('Enter value of shear stress in N/mm2: ');

% Radius of Mohr Circle

r = sqrt(((sigma_x-sigma_y)/2)^2+shear_t^2);

twotheta = atan(shear_t/((sigma_x-sigma_y)/2));

theta = twotheta/2;

theta_2 = 0:1:360;

theta_2 = theta_2.*pi/180;

x = r*cos(theta_2)+sigma_c;

y = r*sin(theta_2);

sigma_1 = max(x);

sigma_2 = min(x);

Sx = [sigma_x shear_t];

Sy = [sigma_y -shear_t];

% all points together

allpoints = [sigma_c 0; sigma_1 0; sigma_2 0; sigma_x shear_t; sigma_y -shear_t];

plot(sigma_1,0,'o','LineWidth',2,'color','k')

hold on

plot(sigma_2,0,'o','LineWidth',2,'color','k')

plot(sigma_c,0,'o','LineWidth',2,'color','k')

plot([Sx(:,1) Sy(:,1)],[Sx(:,2) Sy(:,2)],'LineWidth',2,'color','k')

plot(x,y)

labels = {'C','P Str','P Str','B','A'};

labelpoints(allpoints(:,1), allpoints(:,2),labels,'SE',0.5,1)

grid on

axis equal

Note: Plzzz don' t give dislike.....Plzzz comment if u have any problem i will try to resolve it.......


Related Solutions

In MatLab 1. Ask the user to enter a 1 x 5 vector of numbers. Determine...
In MatLab 1. Ask the user to enter a 1 x 5 vector of numbers. Determine the size of the user entry. 2. Ask the user to enter a 1 x 5 vector of numbers. Determine the size of the user entry. If the user enters a 5 x 1 vector, use a warning statement to inform the user of their error, and set the new input value to be the transpose of the user input value. If the user...
PYTHON Ask the user to enter the number of students in the class. Thereafter ask the...
PYTHON Ask the user to enter the number of students in the class. Thereafter ask the user to enter the student names and scores as shown. Output the name and score of the student with the 2nd lowest score. NOTE: You may assume all students have distinct scores between 0 and 100 inclusive and there are at least 2 students NOTE: You may only use what has been taught in class so far for this assignment. You are not allowed...
USE MATLAB Write a program in Matlab that would continuously ask the user for an input...
USE MATLAB Write a program in Matlab that would continuously ask the user for an input between 1 and 6, which would represent the result of rolling a die. The program would then generate a random integer between 1 and 6 and compare its value to the value entered by user. If the user’s die is larger, it should display, “Mahahanap mo na ang forever mo. Sana all!” If the user’s die is smaller, it should display, “Gising na friend,...
Write a program that will ask the user to enter the amount of a purchase. The...
Write a program that will ask the user to enter the amount of a purchase. The program should then compute the state and county sales tax. Assume the state sales tax is 5 percent and the county sales tax is 2.5 percent. The program should display the amount of the purchase, the state sales tax, the county sales tax, the total sales tax, and the total of the sale (which is the sum of the amount of purchase plus the...
MATLAB The user is supposed to enter either a ‘yes’ or ‘no’ in response to a...
MATLAB The user is supposed to enter either a ‘yes’ or ‘no’ in response to a prompt. The script will print “OK, continuing” if the user enters either a ‘y’, ‘Y’,'Yes', or 'yes' or it will print “OK, halting” if the user enters a ‘n’, ‘N’, 'No', or 'no' or will print “Error” if the user enters anything else. Code this twice once with if and once with switch: Then recode the example above to keep prompting until an an...
I need to ask a user what numbers they want to enter. They can enter as...
I need to ask a user what numbers they want to enter. They can enter as many as they like. Then inside I need to use conditionals to determine if the numbers are <=20, <=323 && > 30, >200. I can't figure out how to let the user enter as many inputs as they want. I know I need to use a loop to check each number entered and determine if it is small middle or greater but I can't...
In C# When the user enters an invalid value, ask the user to repeatedly enter the...
In C# When the user enters an invalid value, ask the user to repeatedly enter the value until a valid value has been entered. Gender must be ‘M’ or ‘F’. Residency must be ‘I’ or ‘O’. Existing Code: using System; public class Student {   public int credit;   public String firstname, lastname, gender, residency, edate;   public void input()   {     Console.WriteLine("\nWelcome to the Continental University Registration System!"); Console.WriteLine("\nEnter data about a student"); Console.Write("First Name: "); firstname = Console.ReadLine(); Console.Write("Last Name: "); lastname...
Your Application should ask the user to enter their name and their salary.
Create a C# Console Application, name the solution Homework 6 and the project TaxRate.Your Application should ask the user to enter their name and their salary. Your application should calculate how much they have to pay in taxes each year and output each amount as well as their net salary (the amount they bring home after taxes are paid!). The only taxes that we will consider for this Application are Federal and FICA. Your Application needs to validate all numeric...
In python Write the code to ask a user to enter a number in the range...
In python Write the code to ask a user to enter a number in the range of 1-100. Have the code checked to make sure that it is in this range. If it is not, let the user re-enter the number. The user should be able to re-enter numbers until the number is within the correct range.
Use a for loop to ask a user to enter the grades of 5 courses. The...
Use a for loop to ask a user to enter the grades of 5 courses. The user should enter character values, e.g., A. Calculate the GPA of the user Hint: Convert the character values entered to numerals, e.g., A to 4 c programming help me please
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT