clear all; % Clear all information
close all; % Close all windows
clc; % Clear Screen
% ABSTRACT
% To plot a graph Radias at interfact VS tua
syms t r;
%%This is to solve a function (0.25*r.^2 - 0.1057 - 0.25*(expint(2*log(r)))) + 0.25*log(log(r)) + (0.1611((r.^2)*log(r) + r.^2 - 1)) = t;
Eq = ((0.25*r.^2) - 0.1057 - (0.25*(expint(2*log(r)))) + (0.25*log(log(r))) + (0.1611*((r.^2)*log(r) + r.^2 - 1))) - t;
rp = linspace(0.3,1,10);
tp = zeros(1,numel(tp));
for irp = 1:numel(rp)
tp(irp) = solve(subs(Eq,'r',rp(irp)));
end
grid on
xlim([0,1])
ylim([0,5])
set(gca,'xtick',0:0.1:1);
set(gca,'ytick',1:0.5:5)
xlabel('\Theta','fontname','Palatino','fontsize',12)
ylabel('\Radias at interface','fontname','Palatino','fontsize',12)
%title('y1 (blue) = x, y2 (green) = x^2')
set(gca,'fontname','Palatino','fontsize',12) % DON'T CHANGE
set(gcf,'paperposition',[1 1 5 5]) % DON'T CHANGE
axis square

3 commentaires

Stephen23
Stephen23 le 18 Juil 2015
Modifié(e) : Stephen23 le 18 Juil 2015
What is the problem? Do you have a question?
pongthep poungthong
pongthep poungthong le 18 Juil 2015
I cannot get a graph from this code. and I don't have idea to improve it.
pongthep poungthong
pongthep poungthong le 18 Juil 2015
I follow your recommendation but I didn't get a graph , I think "the Eq" is type not correctly. I don't know how to improve it. Thank you very much for your answers.

Connectez-vous pour commenter.

 Réponse acceptée

Star Strider
Star Strider le 18 Juil 2015
Modifié(e) : Star Strider le 18 Juil 2015
You have to take ‘t’ out of the ‘Eq’ equation first, then make some other changes (see relevant ‘%’ comments) add the missing plot call, plot the real, imaginary and magnitude components of ‘Eq’, and your code works:
%This is to solve a function (0.25*r.^2 - 0.1057 - 0.25*(expint(2*log(r)))) + 0.25*log(log(r)) + (0.1611((r.^2)*log(r) + r.^2 - 1)) = t;
Eq = ((0.25*r.^2) - 0.1057 - (0.25*(expint(2*log(r)))) + (0.25*log(log(r))) + (0.1611*((r.^2)*log(r) + r.^2 - 1)));
rp = linspace(0.3,1,10);
tp = zeros(1,numel(rp)); % Change to ‘numel(rp)’
for irp = 1:numel(rp)
tp(irp) = vpa(subs(Eq,'r',rp(irp))); % Remove ‘solve’ Call
end
figure(1)
plot(rp, real(tp),'--', rp, imag(tp),'--', rp,abs(tp),'-') % Plot Call
grid on
xlim([0,1])
ylim([0,5])
set(gca,'xtick',0:0.1:1);
set(gca,'ytick',1:0.5:5)
xlabel('\Theta','fontname','Palatino','fontsize',12)
ylabel('\\Radias at interface','fontname','Palatino','fontsize',12)
%title('y1 (blue) = x, y2 (green) = x^2')
set(gca,'fontname','Palatino','fontsize',12) % DON'T CHANGE
set(gcf,'paperposition',[1 1 5 5]) % DON'T CHANGE
axis square
legend('Re\{Eq\}', 'Im\{Eq\}', '|Eq|')
EDIT — Added real, imaginary, and absolute values of ‘Eq’ to the plot and legend calls.

Plus de réponses (1)

Thorsten
Thorsten le 18 Juil 2015
There is no plot command
plot(rp, tp)

2 commentaires

pongthep poungthong
pongthep poungthong le 18 Juil 2015
I knew that but I think my code is wrong and I cannot find them.
pongthep poungthong
pongthep poungthong le 18 Juil 2015
I think "0.25*(expint(2*log(r))))" in Eq is not correct . What does it change to?.

Connectez-vous pour commenter.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by