1 view (last 30 days)

clc

momenta = zeros();

Ti = 0;

Tinc = pi/180;

Tf = pi;

Pi = 0;

Pinc = 10;

Pf = 200;

for theta = Ti:Tinc:Tf

for P = Pi:Pinc:Pf

t = theta/Ti;

p = P/Pi;

momenta(t,p) = -6000 + (p*sin(theta))*(33)-(p*cos(theta))*(25);

%t is the counter for theta increments

%p is the counter for P

%These must be integers

end

end

%For Plotting Purposes

[theta,P] = meshgrid(Ti:Tinc:Tf,Pi:Pinc:Pf);

figure

surf(theta,P,momenta)

KSSV
on 31 Mar 2020

Edited: KSSV
on 31 Mar 2020

You need not to use two for loops.....that is a wrong idea.

This is what you should do:

Ti = 0;

Tinc = pi/180;

Tf = pi;

Pi = 0;

Pinc = 10;

Pf = 200;

%For Plotting Purposes

[theta,P] = meshgrid(Ti:Tinc:Tf,Pi:Pinc:Pf);

momenta = -6000 + (P.*sin(theta))*(33)-(P.*cos(theta))*(25);

figure

surf(theta,P,momenta)

KSSV
on 31 Mar 2020

momenta = zeros();

Ti = 0;

Tinc = pi/180;

Tf = pi;

Pi = 0;

Pinc = 10;

Pf = 200;

%For Plotting Purposes

theta = Ti:Tinc:Tf ;

P = Pi:Pinc:Pf ;

nx = length(theta) ; ny = length(P) ;

[theta,P] = meshgrid(theta,P);

momenta = zeros(ny,nx) ;

for i = 1:ny

for j = 1:nx

momenta(i,j) = -6000 + (P(i,j)*sin(theta(i,j)))*(33)-(P(i,j)*cos(theta(i,j)))*(25);

end

end

figure

surf(theta,P,momenta)

Sign in to comment.

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.