Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Execute MATLAB/Octave Online

x = [1 2 3 4 5 6 7 8 9 10];
y1 = [.16 .08 .04 .02 .013 .007 .004 .002 .001 .0008 ];
y2 = [.16 .07 .03 .01 .008 .003 .0008 .0003 .00007 .00002 ];

semilogy(x,y1,'-bo;y1;',x,y2,'-kx;y2;');
title('Plot title');
xlabel('X Axis');
ylabel('Y Axis');

print -dpng figure.png

Pn plot n=10

x = [];
y1 = [];

n = 10;

for k = 1:n
    xk = -1 + (2*k/n);
    x(end+1) = xk;
    y = 1/( 25*xk*xk + 1);
    y1(end+1) = y;
 end
 
semilogy(x,y1,'-bo;y1;');
title('Polynomial Pn');
xlabel('X Axis');
ylabel('Y Axis');

print -dpng figure.png

vsfv

clc;
clear all;
d=.00874;
    R=10*10^0;
w=2500:.05:4000;
w1=2500:.05:4000;
f=w/(2*3.14);
f1=w1/(2*3.14);
a=6.1355*10^(-3);
o=9.69*10^(-4);
wn=3202.93;
wd=3156.328;
c=7.57*10^(-9);
m=1.94*10^(-4);
A=(o/m+2*d*wn/(R*o)+c.*(wn^2-w1.^2)./o);
B=(w1.*(2*d*wn*c)./o-(wd^2-w1.^2)./(w1.*(R*o)));
K=A.^2+B.^2;
M=9.81./sqrt(K);
y=max(M);
x=f1(M==y);
hold on;
%plot(f,M,'b','LineWidth',2)

o1=1.316*10^(-3);
A1=(o1/m+2*d*wn/(R*o1)+c.*(wn^2-w.^2)./o1);
B1=(w.*(2*d*wn*c)./o1-(wn^2-w.^2)./(w.*(R*o1)));
K1=A1.^2+B1.^2;
M1=9.81*1.566./sqrt(K1);
y1=max(M1);
x1=f(M1==y1);
hold on;
plot(f,M1,'r','LineWidth',2)
x1
y1

p2=0.08422;
c1=7.57*10^(-9);
A2=p2+(2*d*wd)/(R*p2)+(c1/p2).*(wd^2-w1.^2);
B2=w1.*(2*d*wd*c1)/p2-(wd^2-w1.^2)./(w1.*(R*p2));
K2=A2.^2+B2.^2;
M2=9.81*0.022445./(sqrt(K2));
y2=max(M2);
x2=f1(M2==y2);
x2
y2
hold on;
plot(f,M2,'g','LineWidth',2)

%plot(f,M,'b','LineWidth',2)

M3=(9.81*(y1/y))./sqrt(K);
plot(f1,M3,'b')
%legend('Lumped','Distributed')
legend('Distributed','Corrected lumped')
xlabel('Frequency (Hz)','FontSize',35)
ylabel('|Voltage FRF|','FontSize',35)
title('|Voltage FRF| Vs Frequency (Hz)','FontSize',35)


print -dpng figure.png

clase2

x = [1 2 3 4 5 6 7 8 9 10];
y1 = [.16 .08 .04 .02 .013 .007 .004 .002 .001 .0008 ];
y2 = [.16 .07 .03 .01 .008 .003 .0008 .0003 .00007 .00002 ];

semilogy(x,y1,'-bo;y1;',x,y2,'-kx;y2;');
title('Plot title');
xlabel('X Axis');
ylabel('Y Axis');

print -dpng figure.png

ecg signal

x=0.01:0.01:2;
default=input('Press 1 if u want default ecg signal else press 2:\n');
if(default==1)
 li=30/72;

 a_pwav=0.25;
 d_pwav=0.09;
 t_pwav=0.16;

 a_qwav=0.025;
 d_qwav=0.066;
 t_qwav=0.166;

 a_qrswav=1.6;
 d_qrswav=0.11;

 a_swav=0.25;
 d_swav=0.066; 
 t_swav=0.09;

 a_twav=0.35;
 d_twav=0.142;
 t_twav=0.2;

 a_uwav=0.035;
 d_uwav=0.0476;
 t_uwav=0.433;
else
 rate=input('\n\nenter the heart beat rate :');
 li=30/rate;

 %p wave specifications
 fprintf('\n\np wave specifications\n');
 d=input('Enter 1 for default specification else press 2: \n');
 if(d==1)
 a_pwav=0.25;
 d_pwav=0.09;
 t_pwav=0.16;
 else
 a_pwav=input('amplitude = ');
 d_pwav=input('duration = ');
 t_pwav=input('p-r interval = ');
 d=0;
 end


 %q wave specifications
 fprintf('\n\nq wave specifications\n');
 d=input('Enter 1 for default specification else press 2: \n');
 if(d==1)
 a_qwav=0.025;
 d_qwav=0.066;
 t_qwav=0.166;
 else
 a_qwav=input('amplitude = ');
 d_qwav=input('duration = ');
 t_qwav=0.1;
 d=0;
 end

 %qrs wave specifications 
 fprintf('\n\nqrs wave specifications\n');
 d=input('Enter 1 for default specification else press 2: \n');
 if(d==1)
 a_qrswav=1.6;
 d_qrswav=0.11;
 else
 a_qrswav=input('amplitude = ');
 d_qrswav=input('duration = ');
 d=0;
 end


 %s wave specifications
 fprintf('\n\ns wave specifications\n');
 d=input('Enter 1 for default specification else press 2: \n');
 if(d==1)
 a_swav=0.25;
 d_swav=0.066;
 t_swav=0.125;
 else
 a_swav=input('amplitude = ');
 d_swav=input('duration = ');
 t_swav=0.125;
 d=0;
 end


 %t wave specifications
 fprintf('\n\nt wave specifications\n');
 d=input('Enter 1 for default specification else press 2: \n');
 if(d==1)
 a_twav=0.35;
 d_twav=0.142;
 t_twav=0.18;
 else
 a_twav=input('amplitude = ');
 d_twav=input('duration = ');
 t_twav=input('s-t interval = ');
 d=0;
 end
 %u wave specifications
 fprintf('\n\nu wave specifications\n');
 d=input('Enter 1 for default specification else press 2: \n'); 
 if(d==1)
 a_uwav=0.035;
 d_uwav=0.0476;
 t_uwav=0.433;
 else
 a_uwav=input('amplitude = ');
 d_uwav=input('duration = ');
 t_uwav=0.433;
 d=0;
 end
end
 pwav=p_wav(x,a_pwav,d_pwav,t_pwav,li);

 %qwav output
 qwav=q_wav(x,a_qwav,d_qwav,t_qwav,li);

 %qrswav output
 qrswav=qrs_wav(x,a_qrswav,d_qrswav,li);
 %swav output
 swav=s_wav(x,a_swav,d_swav,t_swav,li);
 %twav output
 twav=t_wav(x,a_twav,d_twav,t_twav,li);

 %uwav output
 uwav=u_wav(x,a_uwav,d_uwav,t_uwav,li);
 %ecg output
 ecg=pwav+qrswav+twav+swav+qwav+uwav;
 figure(1)
 plot(x,ecg); 

hw1

13.5.Write a MATLAB script (or function) that extracts 
the connected components of a binary image and displays 
the results using different colors for each component and 
overlays a cross-shaped symbol on top of each component’s center of gravity
https://uk.mathworks.com/help/images/label-and-measure-objects-in-a-binary-image.html

I = imread('morph.bmp');
cc = bwconncomp(BW)
labeled = labelmatrix(cc);
RGB_label = label2rgb(labeled, @copper, 'c', 'shuffle');
imshow(RGB_label,'InitialMagnification','fit')


14.1.Write a MATLAB script to generate a test image containing an ideal edge and
plot the intensity profile and the first and second derivatives along a horizontal line
of the image.

https://uk.mathworks.com/help/images/intensity-profile-of-images.html
https://uk.mathworks.com/help/images/edge-detection.html
https://courses.engr.illinois.edu/cs543/sp2011/lectures/Lecture%2008%20-%20Finding%20Edges%20and%20Straight%20Lines%20-%20Vision_Spring2011.pdf
https://uk.mathworks.com/help/matlab/ref/diff.html

https://web.njit.edu/~cliu/Courses/Fall2001/images_tb.pdf

I = imread('morph.bmp');

improfile
first order 
BW = edge(I,'Prewitt')	
improfile


16.6 Use the edge function inMATLAB and write a script to compute and display
the edges of a color image for the following cases:
(a) RGB image, combining the edges from each color channel by adding them
up.
(b) RGB image, combining the edges from each color channel with a logical
OR operation.
(c) YIQ image, combining the edges from each color channel by adding them
up.
(d) YIQ image, combining the edges from each color channel with a logical
OR operation.


6. Log the results to Table 17.2.
7. Write code to calculate and display the RMS error and the PSNR (dB) between
the original image and each of the lower quality resulting images.
8. Show the results inTable 17.3 and compare them with your subjective evaluation
of image quality.


https://uk.mathworks.com/matlabcentral/fileexchange/22924-count-of-coins
https://uk.mathworks.com/matlabcentral/fileexchange/25157-image-segmentation-tutorial


import networkx as nx
import matplotlib.pyplot as plt

G = nx.DiGraph()
G.add_edges_from(
    [('A', 'B'), ('A', 'C'), ('D', 'B'), ('E', 'C'), ('E', 'F'),
     ('B', 'H'), ('B', 'G'), ('B', 'F'), ('C', 'G')])

val_map = {'A': 1.0,
           'D': 0.5714285714285714,
           'H': 0.0}

values = [val_map.get(node, 0.25) for node in G.nodes()]

# Specify the edges you want here
red_edges = [('A', 'C'), ('E', 'C')]
edge_colours = ['black' if not edge in red_edges else 'red'
                for edge in G.edges()]
black_edges = [edge for edge in G.edges() if edge not in red_edges]

# Need to create a layout when doing
# separate calls to draw nodes and edges
pos = nx.spring_layout(G)
nx.draw_networkx_nodes(G, pos, cmap=plt.get_cmap('jet'), 
                       node_color = values, node_size = 500)
nx.draw_networkx_labels(G, pos)
nx.draw_networkx_edges(G, pos, edgelist=red_edges, edge_color='r', arrows=True)
nx.draw_networkx_edges(G, pos, edgelist=black_edges, arrows=False)
plt.show()

https://stackoverflow.com/questions/20133479/how-to-draw-directed-graphs-using-networkx-in-python

Execute MATLAB/Octave Online

clc;
clear all;
Ps= input('enter the LED output power:');
PsdBm=10*log 10(ps/0.001);
disp=(PsdBm);
C = input('enter the number of connectors:');
Closs=input ('enter the loss at eacch connectors:');
Lc=C*Closs;
L=input('enter the length:');
a=('enter the attenuation:');
CL=L*a;
S=input('enter the number of splices:');
Sloss=input('enter the loss at each splices:');
Ls=S*Sloss;
SM=input('enter the system margin: ');
TL=CL+Lc+Ls+SM;
Pr=input('enter the receiver sensitivity:');
fprintf('\total loss :%f',TL);
fprintf('\npower receieved :%f\n',pr);
Pt=PsdBm-Pr;
fprintf('totalloss:%f',pt);

shahin

Y = -10:0.1:10;
X = 5 * ones(size(Y));
plot(X, Y);

Execute MATLAB/Octave Online

a=1; b=3; alpha=0; TOL=0.000001;
hmax=0.5; hmin=0.05; h=hmax;
B=zeros(1,5);
i=1;
B(i,1)=a; B(i,2)=alpha; B(i,3)=h;B(i,4)=alpha;
flag=1;
while flag==1
 t= B(i,1);
 w=B(i,2);
 k1=h*(1+(w/t)^2+w/t);
 k2=h*(((k1/4+w)/(t+h/4))^2+(k1/4+w)/(t+h/4)+1);
 k3=h*(((3*k1/32 + 9*k2/32+w)/(3*h/8+t))^2 ... 
               +(3*k1/32 + 9*k2/32+w)/(3*h/8+t) +1);
 k4=h*(((1932*k1/2197 - 7200*k2/2197 + 7296*k3/2197 +w)/(12*h/13+t) ...
 )^2 +(1932*k1/2197 - 7200*k2/2197 ...
           + 7296*k3/2197 +w)/(12*h/13+t) +1);
 k5=h*(((439*k1/216 - 8*k2 + 3680*k3/513 -845*k4/4104+w)/ ...
      (h+B(i,1)))^2+(439*k1/216 - 8*k2 + 3680*k3/513 ...
           -845*k4/4104+w)/(h+t) +1);
 k6=h*(((-8*k1/27 + 2*k2 - 3544*k3/2565 +1859*k4/4104 - 11*k5/40 ...
 +w) / (h/2+t))^2+(-8*k1/27 + 2*k2 - ...
 3544*k3/2565 +1859*k4/4104 - 11*k5/40+w) ...
 /(h/2+t) +1);
 R=abs(k1/360 -128*k3/4275 -2197*k4/75240 +k5/50 +2*k6/55)/h;
 if R<=TOL
 B(i+1,:)=[B(i,1)+h 0 0 0 0];
 B(i+1,3)=B(i+1,1)-B(i,1);
 B(i+1,2)=B(i,2)+25*k1/216 +1408*k3/2565+2197*k4/4104 - k5/5;
 i=i+1;
 end
 delta=0.84*(TOL/R)^0.25;
 if delta<0.1  h=0.1*h; elseif delta>=4 h=4*h; else h=delta*h; end
 if h>hmax h=hmax; end
 if B(i,1)>=b flag=0; elseif B(i,1)+h >b h=b-B(i,1); elseif h<hmin flag=0;
 end
end
B(:, 4)=B(:,1).*tan(log(B(:, 1)));
B(:, 5)=B(:, 4) - B(:, 2);
B

onkar

x = [1 2 3 4 5 6 7 8 9 10];
y1 = [.16 .08 .04 .02 .013 .007 .004 .002 .001 .0008 ];
y2 = [.16 .07 .03 .01 .008 .003 .0008 .0003 .00007 .00002 ];

semilogy(x,y1,'-bo;y1;',x,y2,'-kx;y2;');
title('Plot title');
xlabel('X Axis');
ylabel('Y Axis');

print -dpng figure.png

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.