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

Stephen23
Stephen23 2015년 7월 18일
편집: Stephen23 2015년 7월 18일
What is the problem? Do you have a question?
I cannot get a graph from this code. and I don't have idea to improve it.
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.

댓글을 달려면 로그인하십시오.

 채택된 답변

Star Strider
Star Strider 2015년 7월 18일
편집: Star Strider 2015년 7월 18일

0 개 추천

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.

추가 답변 (1개)

Thorsten
Thorsten 2015년 7월 18일

1 개 추천

There is no plot command
plot(rp, tp)

댓글 수: 2

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

댓글을 달려면 로그인하십시오.

카테고리

태그

Community Treasure Hunt

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

Start Hunting!

Translated by